为了本地化Movilizer应用程序(提供多语言支持),我使用以下方法替换屏幕的占位符:
$global:setPlaceholders = function(key)
{
fieldNames = getMasterdata($masterdata:"localisation", key);
fieldNames = fieldNames["data"];
for(entry : fieldNames)
{
setPlaceholder(concat("%", entry, "%"), fieldNames[entry]);
}
};
<answer ... >
<text>%KEY%</text>
</answer>
<onEnterAssignment>
call($global:setPlaceholders)("process1.screen1");
</onEnterAssignment>使用本地化的MasterData
<MovilizerRequest ... >
<masterdataPoolUpdate pool="localisation">
<update key="InventoryManagement.StartScreen" group="DEFAULT">
<language language="en_us">
<data>
<entry name="KEY">
<valstr>Entry</valstr>
</entry>
</data>
</language>
<language language="de">
<data>
<entry name="KEY">
<valstr>Eingabe</valstr>
</entry>
</data>
</language>
</update>
</masterdataPoolUpdate>
</MovilizerRequest>是否有更好、更标准的方法来本地化Movilizer应用程序?
发布于 2016-06-30 22:27:15
在本地化任务方面,其他有用的方法:
$global:getLocale = function(pool, key)
{
fieldNames = getMasterdata($masterdata:"localisation", pool);
fieldNames = fieldNames["data"];
return fieldNames[key];
};
$global:getLocaleWithReplacement = function(pool, key, replacement)
{
fieldNames = getMasterdata($masterdata:"localisation", pool);
fieldNames = fieldNames["data"];
locale = fieldNames[key];
locale = strReplace(locale, "%1%", replacement);
return locale;
};
$global:getLocaleWithReplacementArray = function(pool, key, replacement)
{
fieldNames = getMasterdata($masterdata:"localisation", pool);
fieldNames = fieldNames["data"];
locale = fieldNames[key];
for(i : replacement)
{
placeholder = concat("%", i, "%");
locale = strReplace(locale, placeholder, replacement[i]);
}
return locale;
};
$global:getLocalizedList = function(pool, key)
{
fieldNames = getMasterdata($masterdata:"localisation", pool);
fieldNames = fieldNames["data"];
filterValues = fieldNames[key];
filterValues = strtokenarray(filterValues, ";");
for(i : filterValues)
{
filter[i] = filterValues[i];
}
return filter;
};On fly语言交换
如果需要在不重新配置和同步的情况下进行语言切换,那么解决方案与这里描述的差不多。需要做的是:
您甚至不需要更改方法签名。
本地化Movelet名称的工作方式如下:
<nameExpression>
call($global:getLocaleWithReplacementArray)("process.movelet", "MOVELET_TITLE", {0 : $global:amount;1 : $global:unit})
</nameExpression>https://stackoverflow.com/questions/37823967
复制相似问题