{"name":"localize","title":"localize","type":"command","url":"https://community.bistudio.com/wiki/localize","revid":340342,"updated":"2023-04-30T12:39:28Z","groups":["Strings","Localization"],"status":"ok","games":{"ofp":"1.00","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.00","arma3_since":"0.50","description":"Used to internationalise text messages. The provided translation key is looked up in Stringtable.xml (or Stringtable.csv).","syntaxes":[{"syntax":"localize stringName","params":[{"name":"stringName","type":"String","description":"string which leads to localisation. Casing does not matter. Arma 3 v2.04 A string starting with \"$\" is supported","type_expr":"String"}],"returns":{"type":"String","type_expr":"String","description":"text found in corresponding entry in stringtable file. If the key could not be found an empty string `\"\"` is returned and an entry is added to .rpt file, for example `String STR_DN_SNAKE not found`"},"form":"unary","right":{"text":"stringName"}}],"examples":[{"text":"```sqf\nhint localize \"STR_West\";                // returns \"BLUFOR\"\nhint localize \"STR_WEST\";                // returns \"BLUFOR\"\nhint localize \"STR_weSt\";                // returns \"BLUFOR\"\nhint localize \"STR_NonExistentString\";    // returns \"\" and logs \"String STR_NonExistentString not found\"\n```","code":["hint localize \"STR_West\";\t\t\t\t// returns \"BLUFOR\"\nhint localize \"STR_WEST\";\t\t\t\t// returns \"BLUFOR\"\nhint localize \"STR_weSt\";\t\t\t\t// returns \"BLUFOR\"\nhint localize \"STR_NonExistentString\";\t// returns \"\" and logs \"String STR_NonExistentString not found\""]},{"code":["hint format [\"Go %1\", localize \"STR_Q_NORTH\"]; // returns \"Go North\""]},{"text":"```sqf\nhint format\n[\n    localize \"STR_ACTION_DROP_WEAPON\",    // \"STR_ACTION_DROP_WEAPON\" contains \"Drop %1\"\n    localize \"STR_SN_RIFLE\"                // \"STR_SN_RIFLE\" contains \"Rifle\"\n]; // returns \"Drop Rifle\"\n```","code":["hint format \n[\n\tlocalize \"STR_ACTION_DROP_WEAPON\",\t// \"STR_ACTION_DROP_WEAPON\" contains \"Drop %1\"\n\tlocalize \"STR_SN_RIFLE\"\t\t\t\t// \"STR_SN_RIFLE\" contains \"Rifle\"\n]; // returns \"Drop Rifle\""]},{"code":["localize \"$STR_USRACT_ADJUST\"; // returns \"Adjust\" since Arma 3 v2.04"]}],"see_also":["isLocalized","diag_localized","getTextRaw","BIS_fnc_localize","WFSideText","parseText","Stringtable.csv","Stringtable.xml"],"notes":[{"user":"Killzone_Kid","date":"2014-09-12T11:55:00Z","text":"The command localize will strip all HTML tags from your Stringtable.xml entries, however there is a way to trick it by substituting tags with HTML code instead:\n\n```xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Key ID=\"STR_TEST_KK\">\n    <Original><![CDATA[<t color='#ff0000'>This doesn't work</t>]]></Original>\n</Key>\n<Key ID=\"STR_TEST_KK2\">\n    <Original>&lt;t color='#ff0000'&gt;This works&lt;/t&gt;</Original>\n</Key>\n```\n\n```sqf\nhint parseText localize \"str_test_kk\";    // no change of colour\nhint parseText localize \"str_test_kk2\";    // hint content is in red\n```"}]}