Internationalization of an application user interfaceInline internationalizationYou can provide the various translations directly in the code: text "[l]Hello[fr:]Bonjour[de:]Guten tag" You need to use an UTF8 text editor to do so. External internationalizationAssuming that the module you are writing is /my_org/my_app/my_module.ui, you write in the code: text "[l]Hello" and then you provide an external /my_org/my_app/my_module.fr file with: "Hello" "Bonjour" and another one /my_org/my_app/my_module.de with: "Hello" "Guten tag" The external files must be UTF8 encoded. Selecting the prefered languageThe language assigned to each user is defined in the 'language' field of the user account. How it worksInternationalization is mostly implemented in /pliant/language/type/text/language.pli An internationalized string has type lStr ('l' stands for 'language'): var lStr s We could get the same through using indexes instead of strings to specify the language: var lStr s When you write: "[l]Hello" as opposed to "Hello" Pliant parser produces an lStr constant instead of an Str constant, so you can write: var lStr s := "[l]Hello[fr:]Bonjour" The most important method for lStr is casting to a standard string: function 'cast Str' l -> s so that you can also write: var Str t := s and it is the same as:: var Str l := language 'language' function first picks the 'language_index' field of the current thread header. As a summary, in the end, when you write: text "[l]Helio[fr:]Bonjour" it produces the same result as: var lStr s := "[l]Hello[fr:]Bonjour" |