{"name":"localize","operator":null,"title":"localize","type":"command","url":"https://community.bistudio.com/wiki/localize","revid":340342,"updated":"2023-04-30T12:39:28Z","groups":["Strings","Localization"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Used to internationalise text messages. The provided translation key is looked up in Stringtable.xml (or Stringtable.csv).","syntaxes":[{"syntax":"localize stringName","since":null,"effect":null,"exec":null,"params":[{"name":"stringName","type":"String","optional":false,"default":null,"description":"string which leads to localisation. Casing does not matter. Arma 3 v2.04 A string starting with \"$\" is supported","types":["String"],"since":null,"text":"stringName: String - string which leads to localisation. Casing does not matter. Arma 3 v2.04 A string starting with \"$\" is supported"}],"returns":{"type":"String","types":["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`","text":"String - 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","operator":null,"left":null,"right":{"text":"stringName","types":["String"]}}],"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\""]},{"text":"```sqf\nhint format [\"Go %1\", localize \"STR_Q_NORTH\"]; // returns \"Go North\"\n```","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\""]},{"text":"```sqf\nlocalize \"$STR_USRACT_ADJUST\"; // returns \"Adjust\" since Arma 3 v2.04\n```","code":["localize \"$STR_USRACT_ADJUST\"; // returns \"Adjust\" since Arma 3 v2.04"]}],"multiplayer":null,"problems":null,"aliases":[],"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><t color='#ff0000'>This works</t></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```"}],"categories":[]}