Client-side Localization
You can specify any "design-time" language specific messages. The resources are automatically exported when the metadata is saved and are available for edit in other defined languages in the Localization Resources editor.
It is not mandatory to define message values for all languages using JavaScript. You should define at least one language (en-GB or ro-RO) using JavaScript. For other languages, go to the Localization Resource entity and fill-in the Value field corresponding to the resources to localize.
At run-time the application will resolve the translations from the database with fallback to the explicit values defined in the script.
var rsMyMessage = new EbsResource({
key : "myMessage",
"en-GB" : "message in English",
"ro-RO" : "mesaj in romana",
"de-DE" : "Meldung auf Deutsch"
});
var rsMyMessageFmt = new EbsResource({
key : "myMessageFmt",
"en-GB" : "Field {0} is empty",
"ro-RO" : "Campul {0} nu este completat",
"de-DE" : "Der Feld {0} ist leer"
});
console.log( rsMyMessage.getString()); // when culture is ro-RO outputs: mesaj in romana
console.log( rsMyMessageFmt.getString("Field1")); // when culture is ro-RO outputs: Campul Field1 este necompletat
ebs.showMessage
The existing method for ebs.showMessage has been modified to accommodate localization.
You can verify the code snippet either in the 'Developer Tools' (in Chrome) or in the After Events field.
Code snippet from Developer Tools:
> ebs.showMessage
< f (englishMessage, type, romanianMessage) {
//type:success, warning, info, error
//englishMessage can be a resource identifier
var Localized = null;
if (englishMessages && englis...
Code snippet for After generate events:
ebs.showMessage(englishMessage, type, romanianMessage);
Code snippet from Developer Tools:
> EbsResource
< f EbsResource(data) {
if (data) {
for (var prop in data) {
this[prop] = data[prop];
}
}
}
var rsMyWarning = new EbsResource({
key : "myWarning",
"en-GB" : "Warning!",
"ro-RO" : "Atentie!",
});
// other code
ebs.showMessage(rsMyWarning.getString(), 'warning'); //new style
ebs.showMessage("english message", 'warning', "mesaj in romana"); // still works for backwards compatibility When saved, the resource keys are automatically inserted in the database and are available for edit in the Localization Resource entity. The resource keys will be saved with the module name following these naming conventions:
aftergenerateJs: entities / entiyName / forms / formName / aftergeneratejs
Example:
entities/Product/forms/default/aftergeneratejs
entities / entiyName / forms / formName / sections / sectionName / aftergeneratejs
Example:
entities/Product/forms/default/sections/Section 1/aftergeneratejs
entities/ entityName/ views/ viewName / aftergeneratejs
Example: entities/Product/views/default/aftergeneratejs
entities / entityName/ forms / formName./ attributes / attributeName/ attributeChangeEventsJs
Example:
entities/Product/forms/default/attributes/Name/attributeChangeEventJs
customActions / actionName / aftergeneratejs
Example:
customActions/Product Promotion/aftergeneratejs