Localization
No edit summary
(Automatically adding template at the end of the page.)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[File:2020-01-04 13h43 42.png|none|thumb|550x550px]]
[[File:2020-01-04 13h43 42.png|none|thumb|550x550px]]
If the Pattern from the above model is discovered by your MDriven system you may install the new IMDrivenUITranslation service – then the MDriven system will use the data found in the objects for the model and use them as translations.
If your MDriven system discovers the pattern from the above model, you may install the IMDrivenUITranslation service. The MDriven system will use the data found in the objects for the model and use them as translations.


The service is installed like this:
The service is installed like this:
MDriven.Translation.MDrivenUITranslationImpl.Install(ecoServiceProvider);// Installs translation services
Newer versions of MDriven Turnkey already do this for you.


MDriven.Translation.MDrivenUITranslationImpl.Install(ecoServiceProvider);// Installs translation services
The IMDrivenUITranslation has a Default-Language setting. The Default Language is set by MDriven Turnkey to the Language set in the user browser. Typically, this is a value like “en-US” or “sv-SE”. You can force the default language with an action like this:  'Whatever'.Translate('DEFAULT=sv-SE');


Newer versions of MDriven Turnkey does this already for you.
To translate to the users' chosen language, do this:
<nowiki>'Translate this text'.Translate(''</nowiki>)
‘Translate this’.Translate(‘sv-SE’) is a valid expression that will try to look up a SysTranslatable object with a Value equal to ‘Translate this’. It will then look for Translations that point out a Language with code that equals ‘sv-SE’. If found, the value of the matching SysTranslation object will be returned. If no matching translation is discovered, the original value is kept.


The IMDrivenUITranslation has a DefaultLanguage setting. The DefaultLanguage is set by MDriven Turnkey to the Language set in the user browser. Typically this is a value like “en-US” or “sv-SE”.<nowiki>''</nowiki>
It would be a complete pain to create all the SysTranslatables by hand. To help you avoid that, you can perform this in an action: 'Whatever'.Translate('SPOOLMISSED'). Sending “SPOOLMISSED” as a language has a special meaning and creates SysTranslatables for all complete misses that the system has seen since the start or since the last call to SPOOLMISSED.


‘Translate this’.Translate(‘sv-SE’) is a valid expression that will try to look up a SysTranslatable object with Value equal to ‘Translate this’, it will then look for Translations that points out a Language with code equals ‘sv-SE’. If found the value of the matching SysTranslation object will be returned. If no matching translation is discovered the original value is kept.
The actual dictionaries used to do the translations are created at the system start-up. This means that you will need to restart your system to see the newly added translations take effect. This may not be a possibility, however, for the translators on your team. Most likely, the translators are just ordinary users or administrators of your system, but they will want to see the effect of an added translation as soon as possible. To mitigate this, we have added yet another special meaning language identifier: 'Whatever'.Translate('RESETCACHE'). This will reset all cached pages in your application since they possibly contain translations – and by the time of the next request, they will be re-done and thus reflect the newly made translations.


It would be a complete pain to create all the SysTranslatables by hand and to help you avoid that you can perform this in an action: 'Whatever'.Translate('SPOOLMISSED') , sending “SPOOLMISSED” as a language has special meaning and create SysTranslatables for all complete misses that system has seen since start or since last call to SPOOLMISSED.
The article introducing this functionality can be found here: https://blog.mdriven.net/localization/


The actual dictionaries used to do the translations are created at system start up. That means that you will need to restart your system in order to see newly added translations to take effect. This may however not be a possibility for the translators on your team – most likely the translators are just ordinary users or administrators of your system – but they will want to see the effect of an added translation as soon as possible. To mitigate this we have added yet another special meaning lnaguage identifier: 'Whatever'.Translate('RESETCACHE'). This will reset all cached pages in your application since they possibly contain translations – and the next request they will be re-done and thus reflect the new translations made.
=== Updates 2020-09-23: Language Mapping Override ===
Add a static method on SysTranslateLanguage with this signature:
CheckLanguageMapping(input:String):String
This method is called when the users' language is detected. You may replace the users' language with some other language in order to implement preferred user language mapping.


The article introducing this functionlity is found here https://blog.mdriven.net/localization/
Maybe you designed in Swedish and you have added translations for English, but you get a French user and want to show English rather than Swedish:
if input.contains('fr') then
  'en'
else
  input
endif
[[File:2020-09-23 11h33 59.png|none|thumb|582x582px]]
[[Category:MDriven Services]]
{{Edited|July|12|2024}}

Latest revision as of 15:36, 10 February 2024

2020-01-04 13h43 42.png

If your MDriven system discovers the pattern from the above model, you may install the IMDrivenUITranslation service. The MDriven system will use the data found in the objects for the model and use them as translations.

The service is installed like this:

MDriven.Translation.MDrivenUITranslationImpl.Install(ecoServiceProvider);// Installs translation services

Newer versions of MDriven Turnkey already do this for you.

The IMDrivenUITranslation has a Default-Language setting. The Default Language is set by MDriven Turnkey to the Language set in the user browser. Typically, this is a value like “en-US” or “sv-SE”. You can force the default language with an action like this:  'Whatever'.Translate('DEFAULT=sv-SE');

To translate to the users' chosen language, do this:

'Translate this text'.Translate('') 

‘Translate this’.Translate(‘sv-SE’) is a valid expression that will try to look up a SysTranslatable object with a Value equal to ‘Translate this’. It will then look for Translations that point out a Language with code that equals ‘sv-SE’. If found, the value of the matching SysTranslation object will be returned. If no matching translation is discovered, the original value is kept.

It would be a complete pain to create all the SysTranslatables by hand. To help you avoid that, you can perform this in an action: 'Whatever'.Translate('SPOOLMISSED'). Sending “SPOOLMISSED” as a language has a special meaning and creates SysTranslatables for all complete misses that the system has seen since the start or since the last call to SPOOLMISSED.

The actual dictionaries used to do the translations are created at the system start-up. This means that you will need to restart your system to see the newly added translations take effect. This may not be a possibility, however, for the translators on your team. Most likely, the translators are just ordinary users or administrators of your system, but they will want to see the effect of an added translation as soon as possible. To mitigate this, we have added yet another special meaning language identifier: 'Whatever'.Translate('RESETCACHE'). This will reset all cached pages in your application since they possibly contain translations – and by the time of the next request, they will be re-done and thus reflect the newly made translations.

The article introducing this functionality can be found here: https://blog.mdriven.net/localization/

Updates 2020-09-23: Language Mapping Override

Add a static method on SysTranslateLanguage with this signature:

CheckLanguageMapping(input:String):String

This method is called when the users' language is detected. You may replace the users' language with some other language in order to implement preferred user language mapping.

Maybe you designed in Swedish and you have added translations for English, but you get a French user and want to show English rather than Swedish:

if input.contains('fr') then
  'en'
else
  input
endif
2020-09-23 11h33 59.png
This page was edited 97 days ago on 02/10/2024. What links here