Translations Omega365


Translations and T-Tables

There are two concepts for translations in Omega365. Translations and T-Tables. T-Tables are used for translating content inside tables. This Article does not describe T-Tables, see separate article.

Usage

Examples in HTML.
@T("hello world!")
Renders as:
hello world!
@T("hello world!", title)
Renders as:
// if you need to do JS in the HTML block var vString = '@("hello world!")'; Renders as: var vString = 'Hello world!'
Example in JS:
alert(aT("hello world!"));
Examples in SQL:
EXEC dbo.afThrow 'Hello world!'
Result:
Hello world!
-- Use up to 3 paramaters. Parameters are not translated.
EXEC dbo.afThrow 'There are %P1 apples in a dozen',@P1 = 12    
Result:
There are 12 apples in a dozen
-- The @Object allows for using the same base string with different translations
EXEC dbo.afThrow 'Hello world!', 'stbl_Translate_Strings'
Result:
Hei verden!

EXEC dbo.afThrow 'Hello world!', 'sstp_Translate_PublishDBObjects'
Result:
heisann verden!

Using ?translate=true

First go to my-profile app and set the language you want to translate. Then, add &translate=true to the URL of any app to enter Translate mode.

Example: https://dev-test.omega365.com/?translate=true&Context=10004

Troubleshooting

1. I have updated translations but they do not show up when i refresh page?

Try Clear localized strings Cache and then Clear localized strings. See screenshot.


2. I am missing basestrings on my solution, what do i do?
EXEC dbo.sstp_Translate_PublishAllDBObjects
EXEC dbo.sstp_Translate_UpdateTranslationsAllApps
EXEC dbo.sstp_Translate_UpdateTranslationsAppframeScripts

Also Clear localized strings Cache and then Clear localized strings. See screenshot.


3. I have updated a users language in persons app but language does not change

Here are some things to try:

  • First log out and in again.
  • If that does not work, check that proc sstp_Database_MessagesSetUserLanguage is called from _Persons_Utrig
  • Proc sstp_Database_MessagesSetUserLanguage checks that language on sql server user is in sync with what is set in _Persons table, if not it generates Alter User statement. By running the SELECT on top of this proc you can check to see if sync is working (should retrun 0 rows).
  • Right click user in MSSMS and open Properties, make sure the correct language is set under default language.
  • If it still does not work try running the Alter User statements in example below to experiment (+ log out).

FAQ

1. My customer wants to change the word "Actual Cost" to "ACWP", can i create a English to English translation to change this?

No.


2. Do i need to Verify translations for them to work?

No.

Set language of user on SQL server

Some error messages comes directly from the SQL server, for example a Truncate error. The SQL server will generate error messages based on what default language is set on the currently logged in user. We therefor need to make sure every sql user has the same language as the person in _Persons table, if not Norwegian persons will get for example english truncate errors. See proc key-db objects sstp_Database_MessagesSetUserLanguage.

ALTER USER [Audun] WITH DEFAULT_LANGUAGE = English
-- or
ALTER USER [Audun] WITH DEFAULT_LANGUAGE = Norwegian

In MSSMS you can right click a user an set a default language. Note that there are both Bokmal and Norwegian in SQL server, in general the Norwegian is the correct one.

Understanding Translations

Appframe requires all strings to be translated to be wrapped in in keywords so that Appframe is able to detect the translation and add it to the table of translations. The examples above shows the different ways to do that in js, html and sql.

All parsing and identifing basestrings are done by stored procedures (see Regeneration of basestrings for names of procs).

The object where Basestring is found (for example a trigger or a app) is part of basestrings Unique Index. It therefor possible to have different translations for the same word in different apps/objects.

The idea behind Verifid field is that new basestrings that are found will be added and verified set to NULL. A human needs to go in and verify new basestrings as they come to ensure propper translations. When clicking "Auto suggest" appframe has some logic to aid with suggesting translations on non-verified basestrings (see sstp_Translate_UpdateStringsFromRanking explenation).

Regeneration of basestrings (populate stbl_Translate_Strings)

Regeneration of basestrings is done by adding basestrings that are missing and deleting basestrings that are not used anymore to the table stbl_Translate_Strings.

Regenerate basestrings is generally safe to do as many times one may want.

  • Apps
    • When clicking Publish, AppDesigner executes sstp_WebSiteCMS_CopyArticle, that executes sstp_Translate_PublishDBObject. This will only create basestring on developer database not on my.omega
    • When clicking regenerate basestrings from all apps (see ponint 2. in screenshot bellow) or EXEC dbo.sstp_Translate_UpdateTranslationsAllApps
    • A single app: EXEC dbo.sstp_Translate_UpdateTranslationsForApp 'Pims365/workflow-item'
  • Db-objects
    • When altering a DB-object, database trigger (strg_Database_ChangeLog) executes sstp_Translate_PublishDBObject, that proc executes sstp_Translate_UpdateTranslationsForApp. This will only create basestring on developer database not on my.omega
    • Generate basestrings for all db-objects EXEC dbo.sstp_Translate_PublishAllDBObjects
    • Generate basestrings for a single db-object EXEC dbo.sstp_Translate_PublishDBObject 'stbl_Translate_Strings_ITrig'
  • Framework
    • EXEC sstp_Translate_UpdateTranslationsAppframeScripts or see screenshot

Key db-objects

Db-object Description
stbl_Translate_Strings Stores basestrings, see above for how this table is populated
stbl_Translate_StringsLocalized Stores the actual Translations of basestrings
stbl_Translate_Languages Languages in use
sviw_Translate_LocalizedStrings View used by app /localized-strings
sviw_Translate_StringsLocalized Used by framework to populate cache after cache has been cleared. See 4. in screenshot below or "Clear Loclized Cache" in /
sviw_Translate_MissingBasestrings Used by code module api/translate/UpdateStringsFromRanking to get basestrings that has never been translated before and needs to be be translated by google. This view should not return anything after api/translate/UpdateStringsFromRanking has been run
sviw_Translate_TranslationsRanking Used internally by sstp_Translate_UpdateStringsFromRanking. This view returns the suggested translation based on logic described in About sstp_Translate_UpdateStringsFromRanking above in this article.
afThrow Synonym for sstp_Translate_ThrowException
sstp_Translate_AddLocalizedString Used by framework in &Translate=True mode to add translations
code-module MessagesSetLang Not in use anymore.
sstp_Database_MessagesSetUserLanguage This proc checks that language on sql server user is in sync with what is set in Pims if not it generates Alter User statement. Proc is executed from _Persons_Utrig. See Troubleshooting number 3 and Set language of user on SQL server.
sstp_Translate_FindTranslations Used interally by Translations to find the actual basestring in apps and db-objects. Keywords are stored here.
sstp_Translate_UpdateStringsFromRanking

After strings are added to stbl_Translate_Strings the proc sstp_Translate_UpdateStringsFromRanking can be used to create suggestions for translations based on other translations in Omega365 and from Google Translate. Translations generated from sstp_Translate_UpdateStringsFromRanking will not be verified by default. Setting verified is done by a human.

  • New basestrings will be matched against strings allready existing in the table. In case it exists, the most used translation is used.
  • New basestrings that does not exist the the table of translations will use google translate.
  • In case there are multiple translations of one string and one is Verified that string will be used
  • The proc sstp_Translate_UpdateStringsFromRanking can be EXEC from management studio, but it will not be able to get Google translations.
  • To be able to get Google translations, run the code module api/translate/UpdateStringsFromRanking. This code module will run sstp_Translate_UpdateStringsFromRanking with a table parameter with google translations.
  • Verified strings will not be updated by sstp_Translate_UpdateStringsFromRanking, but non Verified strings can.
    Example: The string "Content" is used in two different apps has two different translations ex. "innhald" and "innhold".A Human sets "innhold" as Verified EXEC sstp_Translate_UpdateStringsFromRanking. Now the other translations will be overwritten and both translations for "content" will be "innhold".


Related articles