Imagine you have a finished project, where all the content is in Russian, and now it has become necessary to add English-language localization. You wrap all the lines into resources, translate the lines into English and call the necessary resource for Russian or English. In principle, nothing complicated. And what if there are many lines and there are mistakes in Russian (or English)? And what if you need to localize not into one language, but ten? It is in such projects that CLM should be used. He in one click localizes all the project content into the desired language with the possibility of correcting incorrect translation.
Caché has a standard approach for implementing I11N using the $$$ TEXT macro.
$$$TEXT("Text", "Domain", "Language")
Where:
Text
is the text that will be used for localization in the future.Domain
are modules in your applications.Language
is the language in which "Text" is written.
When using $$$ TEXT in COS code, data is compiled into global ^ CacheMsg when compiling classes. CLM works with this global.
In ^ CacheMsg, everything is the same as $$$ TEXT , only the "ID" is added in the form of a text hash.
^CacheMsg("Domain", "Language", "ID") = "Text"
<csp:text id="14218931" domain="HOLEFOODS">Date Of Sale</csp:text>
The first step is to download the Installer class from GitHub and import it into any convenient area in Caché. I will use the USER area. After that, open the terminal and go to the USER area. To start the installation, just enter one command:
USER> do ##class(CLM.Installer).setup()
Albanian Arabian Armenian Azeri Belarusian Bosnian Basque Bulgarian Catalan Croatian Czech Chinese Danish Dutch English Estonian Esperanto Finnish French Georgian German Greek Hebrew Hungarian Icelandic Indonesian Italian Japanese Kazan Korean Latin Latvian Lithuanian Macedonian Malay Maltese Norwegian Polish Portuguese Brazil Romanian Russian Spanish Serbian Slovak Slovenian Swedish Thai Turkish Ukrainian Vietnamese
Criticism, comments, suggestions - are welcome.
All source code and instructions are also available on github under the MIT license.
Source: https://habr.com/ru/post/313206/
All Articles