Hello
In some cases we define a label which shall show a parametrized string only.
One example may be a lable in UC_GLBatches.yaml.
this.lblValidDateRange.Text = Catalog.GetString("Valid Date Range:");
Here the lable name lblValidDateRange generates the catalog string "Valid Date Range:"
But inside the manual code I use the real string
lblValidDateRange.Text = String.Format(Catalog.GetString("Valid between {0} and {1}"),
StringHelper.DateToLocalizedString(StartDateCurrentPeriod, false, false),
StringHelper.DateToLocalizedString(EndDateLastForwardingPeriod, false, false));
Problem:
One Label creates two catalog strings and the first one is worthless to be used.
Solution:
- The automatic solution is our defaul solution for the future.
- The label can get an yaml-option like
lblValidDateRange: {manualCodeLabel="Valid between {0} and {1}"}
or
lblValidDateRange: {autocodeLabel="Something specific"}
But in this case the generated code shall looks like:
this.lblValidDateRange.Text = Catalog.GetCatString("lblValidDateRange");
The Catalog.GetString shall remain unchanged and the new Catalog.GetCatString shall be based on the name of the control.
This means that the catalog can be switched during a runtime session.
Catalog.SetLanguage("en-US"); // US-American string
this.lblValidDateRange.Text = Catalog.GetCatString("lblValidDateRange");
Catalog.SetLanguage("de-CH"); // String in German with a Swiss dialect
this.lblValidDateRange.Text = Catalog.GetCatString("lblValidDateRange");
This organisation also avoids ressource chaos if the developer changes the string to from "Valid between {0} and {1}" to "You must not insert dates below {0} or above {1}".
Best regards Wolfgang