Mobile 为Movilizer应用程序提供本地化/多语言支持

Mobile 为Movilizer应用程序提供本地化/多语言支持,mobile,movilizer,Mobile,Movilizer,要本地化Movilizer应用程序(提供多语言支持),我将使用以下方法替换屏幕的占位符: $global:setPlaceholders = function(key) { fieldNames = getMasterdata($masterdata:"localisation", key); fieldNames = fieldNames["data"]; for(entry : fieldNames) { setPlaceholder(con

要本地化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>
$global:setPlaceholders=函数(键)
{
字段名=getMasterdata($masterdata:“本地化”,键);
fieldNames=fieldNames[“数据”];
for(条目:字段名)
{
setPlaceholder(concat(“%”),entry(“%”),fieldNames[entry]);
}
};
%关键%
调用($global:setPlaceholders)(“process1.screen1”);
使用本地化的主数据

<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应用程序?

其他在本地化任务方面有用的方法

    $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;
    };
即时语言切换

如果需要在不重新配置和同步的情况下进行语言切换,那么解决方案与这里描述的并不遥远。需要做的是:

  • 创建并设置全局语言变量

  • 调整主数据,使键的数据部分中有多个语言子数组,并相应地调整方法

  • 您甚至不需要更改方法签名

    本地化Movelet名称的工作方式如下:

    <nameExpression>
      call($global:getLocaleWithReplacementArray)("process.movelet", "MOVELET_TITLE", {0 : $global:amount;1 : $global:unit})
    </nameExpression>
    
    
    调用($global:getLocaleWithReplacementArray)($process.movelet”,“movelet_TITLE”,{0:$global:amount;1:$global:unit})
    
    这取决于要求。这种方法取决于参与者注册时使用的语言。在飞行中切换语言变得很棘手。如果不需要切换,则可以。但是Masterdata创建需要默认语言