Ticket #3355: t3355_fix_translation_context_v1.patch

File t3355_fix_translation_context_v1.patch, 1.2 KB (added by elexis, 9 years ago)

The translations of the starting resources were still extracted correctly after r17052, but the translation context wasn't handed over anymore to the actual translation call.

  • binaries/data/mods/public/gui/common/settings.js

    function loadSettingValuesFile(filename)  
    6262        error("Could not load " + filename + "!");
    6363        return undefined;
    6464    }
    6565
    6666    if (json.TranslatedKeys)
    67         translateObjectKeys(json.Data, json.TranslatedKeys);
     67    {
     68        let keyContext = json.TranslatedKeys;
     69
     70        if (json.TranslationContext)
     71        {
     72            keyContext = {};
     73            for (let key of json.TranslatedKeys)
     74                 keyContext[key] = json.TranslationContext;
     75        }
     76
     77        translateObjectKeys(json.Data, keyContext);
     78    }
    6879
    6980    return json.Data;
    7081}
    7182
    7283/**
  • binaries/data/mods/public/simulation/data/settings/starting_resources.json

     
    11{
    22    "TranslatedKeys": ["Title"],
     3    "TranslationContext": "startingResources",
    34    "Data":
    45    [
    56        {
    67            "Resources": 100,
    78            "Title": "Very Low"