Quantcast
Channel: Microsoft Dynamics AX
Viewing all articles
Browse latest Browse all 101540

Blog Post: Add additional languages to Infocodes and Products

$
0
0
One of the challenges implementing a multi-country project is to deal with the languages that may come into play. While testing the system, we, consultants, usually don't pay enough attention to the translations until we miss them. And then we rush to add a translation to two or three elements, like products and info codes. The problem lays on the different languages the users are to use versus the language we use to test. Let's say you use English (en-us) in an implementation whereas the users are to use German (de), Spanish (sp) and Dutch (nl). Then, you configure products and Info codes in English, and when to hand the test over to the user, the POS doesn't show the proper names and descriptions. Added to that, it's expected that the right translations are to be taken care when the project is close to going live. To fix it manually, you go to the Info codes form and add the languages to be tested, as the example below: But doing this for each record takes to much of our precious time. To solve this problem I created a job that adds the translations to the Info codes and Products. Worth to mention that the job doesn't translate the text. It only adds the same names or descriptions to the other languages, which is very helpful to test the system and confirm it reacts according to the user preferred language. The final result looks like this: And here is the code: static void TranslateEntities(Args _args) { RetailInfocodeTranslation iCode; RetailInfocodeTranslation iTrans; RetailInformationSubcodeTranslation iSub; RetailInformationSubcodeTranslation iSubT; EcoResProduct iProd; EcoResProductTranslation iProdT; Dialog dialog; DialogField _legalEntity; CompanyInfo _company; int i, nInfo, nSub, nProd; int j = 3; // Number of languages to add str _lang[j]; str 4 _dataAreaId; str 10 _systemLanguage; ; // Fill in with the languages to be added _lang[1] = 'es'; _lang[2] = 'de'; _lang[3] = 'nl'; dialog = new Dialog("Add translation language"); dialog.addText("Select a company:"); _legalEntity = dialog.addField(extendedTypeStr(LegalEntity)); dialog.run(); if (dialog.closedOk()) { startLengthyOperation(); _systemLanguage = SystemParameters::getSystemLanguageId(); select * from _company where _company.RecId == _legalEntity.value(); { _dataAreaId = _company.DataArea; } setPrefix( strFmt('Starting adding other languages...')); info( strFmt('Company %1, system language = %2', _dataAreaId, _systemLanguage ) ); for (i=1; i <= j ; i++) { setPrefix( strFmt('Language: %1', _lang[i]) ); nInfo = 0; nSub = 0; nProd = 0; ttsBegin; while select * from iCode where iCode.LanguageId == _systemLanguage && iCode.DataAreaId == _dataAreaId { try { select iTrans; iTrans.Infocode = iCode.Infocode; iTrans.description = '(' + _lang[i] +') ' + iCode.description; iTrans.prompt = '(' + _lang[i] + ') ' + iCode.prompt; iTrans.LanguageId = _lang[i]; iTrans.insert(); nInfo++; } catch { exceptionTextFallThrough(); } } ttsCommit; info( strFmt('RetailInfocodeTranslation: %1 records included.',nInfo)); ttsBegin; while select * from iSub where iSub.LanguageId == _systemLanguage && iSub.DataAreaId == _dataAreaId { try { select iSubT; iSubT.InfoSubcode = iSub.InfoSubcode; iSubT.description = '(' + _lang[i] + ') ' +iSub.description; iSubT.LanguageId = _lang[i]; iSubT.insert(); nSub++; } catch { exceptionTextFallThrough(); } } ttsCommit; info( strFmt('RetailInformationSubcodeTranslation: %1 records included.',nSub)); ttsBegin; while select * from iProd where iProd.RecId == 999 { try { EcoResProductTranslation::createOrUpdateTranslation( iProd.RecId , '(' + _lang[i] + ') ' + iProd.productName(_systemLanguage), '(' + _lang[i] + ') ' + iProd.productDescription(_systemLanguage), _lang[i] ); nProd++; } catch { exceptionTextFallThrough(); } } ttsCommit; info( strFmt('EcoResProductTranslation: %1 records included/updated.',nProd)); } // for endLengthyOperation(); } // if } I hope this tip help you!

Viewing all articles
Browse latest Browse all 101540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>