Uniconta uses Labels for Localization. The labels can be found in the Uniconta client under Tools -> Report Generator -> Labels.
Programmatically, when we wish to Localize or translate plugins or applications, we can use these labels using the Localization class from the Uniconta.ClientTools namespace.
// An initialized CrudAPI is required to use the Localization.lookup method. var crud = new CrudAPI(ses, comp); var da = Language.da; var en = Language.en; var de = Language.de; var daDebtor = Localization.lookup("Debtor", da); var enDebtor = Localization.lookup("Debtor", en); var deDebtor = Localization.lookup("Debtor", de);
When calling the Localization method we pass a language variable. Language is an enum from the Uniconta.Common namespace.
In the example code above we translate the Label Debtor to Danish, English, and German.
New Labels
Are the current labels not sufficient for you Localization needs? Worry no more!
You can acquire a Localization variable of a specific language, such as Danish, and add your own labels to the Localization.
var loc = Localization.GetLocalization(Language.da); loc.AddLabel("BestProgrammingLanguage", "C# Er det bedste programmeringssprog");
In the example above we are in need of a label for the best programming language in a Danish context.
When we call loc.lookup(“BestProgrammingLanguage”), we will get the Danish sentence telling us that C# is the best programing language.