BIS fnc localize: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Added note about localize engine command)
m (Some wiki formatting)
 
(27 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.00


| arma3 |= Game name
|gr1= Strings


|1.00|= Game version
|descr= Checks if passed string is localization key and if so, return the localized text. Else, returns the passed string itself.
____________________________________________________________________________________________


| Checks if passed string is localization key and if so, return the localized text. Else, returns the passed string itself.
|s1= localizationString call [[BIS_fnc_localize]]
{{Feature arma3|This function does exactly the same as the command [[localize]]}}
|= Description
____________________________________________________________________________________________


| [localizationString] call [[BIS_fnc_localize]] |= Syntax
|p1= localizationString: [[String]]


|p1= localizationString: [[String]] |= Parameter 1
|r1= [[String]] - the localized text behind the key or the key itself (if not localized).


| [[String]] - the localized text behind the key or the key itself (if not localized). |= Return value
|x1= <sqf>
____________________________________________________________________________________________
// assuming the stringtable contains a key "STR_someString" with the value "Hello world"
"STR_someString" call BIS_fnc_localize; // returns "Hello world"


|x1= <code><i>//assuming the [[Stringtable.xml|stringtable]] contains a key "STR_someString" with the value "Hello world"</i>
// assuming the stringtable does not contain a key "STR_anotherString"
["STR_someString"] [[call]] [[BIS_fnc_localize]]; //returns "Hello world"
"STR_anotherString" call BIS_fnc_localize; // returns "STR_anotherString"
</sqf>


<i>//assuming the [[Stringtable.xml|stringtable]] does not contain a key "STR_anotherString"</i>
|seealso= [[isLocalized]] [[localize]] [[Stringtable.xml]]
["STR_anotherString"] [[call]] [[BIS_fnc_localize]];  //returns "STR_anotherString" </code> |= Example
}}
 
____________________________________________________________________________________________
 
| |= See also


{{Note
|user= Vincent H.
|timestamp= 20171229000300
|text= Unfortunately [[localize]] does not exactly do the same as [[BIS_fnc_localize]].<br>
[[BIS_fnc_localize]] also checks if it the input string [[isLocalized]] while [[localize]] will return an empty string if the input parameter is not localized.
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Misc|{{uc:localize}}]]
[[Category:Functions|{{uc:localize}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:localize}}]]

Latest revision as of 20:33, 18 April 2022

Hover & click on the images for description

Description

Description:
Checks if passed string is localization key and if so, return the localized text. Else, returns the passed string itself.
Execution:
call
Groups:
Strings

Syntax

Syntax:
localizationString call BIS_fnc_localize
Parameters:
localizationString: String
Return Value:
String - the localized text behind the key or the key itself (if not localized).

Examples

Example 1:
// assuming the stringtable contains a key "STR_someString" with the value "Hello world" "STR_someString" call BIS_fnc_localize; // returns "Hello world" // assuming the stringtable does not contain a key "STR_anotherString" "STR_anotherString" call BIS_fnc_localize; // returns "STR_anotherString"

Additional Information

See also:
isLocalized localize Stringtable.xml

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Vincent H. - c
Posted on Dec 29, 2017 - 00:03 (UTC)
Unfortunately localize does not exactly do the same as BIS_fnc_localize.
BIS_fnc_localize also checks if it the input string isLocalized while localize will return an empty string if the input parameter is not localized.