Is there a solution to generate diagrams for several languages with the same description file

0 votes
asked Aug 6, 2018 in Wanted features by anonymous

Hello,

Is there a solution to generate diagrams for several languages (one PNG per language) with the same and unique description file ?

Could it be possible to manage language properties file (such as en_us.properties or fr_fr.properties in the same directory as the description file) and use the keys within the description file when generating PNG files (one per detected language).

Sample description file :

@startuml
Alice -> Bob: @authentication.request
Bob --> Alice: @authentication.response

Alice -> Bob: @another.authentication.request
Alice <-- Bob: @another.authentication.response
@enduml

Sample en_us.properties file :

authentication.request = Authentication Request
authentication.response = Authentication Response
another.authentication.request = Another authentication Request
another.authentication.request = Another authentication Response

The generated PNG file could have the en_us suffix at the end.

There is probably a better solution to do it without duplicating the description file 

There may be a better way to do it without duplicating the description file but it would need some reflection before implementing it.

Thanks a lot.

1 Answer

0 votes
answered Aug 6, 2018 by Serge Wenger Work (15,620 points)

Hello,

You can do like this minimal sample:

@startuml
' if you comment next line, it will be french
!define English

!ifdef English
' you can do the same for include
!define Def_txt1 English
!else
!define Def_txt1 Français
!endif
Bob -> Alice : Def_txt1
@enduml

commented Aug 6, 2018 by Serge Wenger Work (15,620 points)
You can set define on command line with -D<YourDefine>
commented Aug 7, 2018 by anonymous
Thanks Serge it is a good starting point
...