Ticket #854 (closed defect: fixed)
Alternative way of passing dynamic replacements to localization
|Reported by:||ray||Owned by:||ray|
The localization system provides the possibilty to localize strings that contain variables. These are passed to the function via js objects. This makes it particularly hard to localize strings containing variables from server-side backends, because you cannot create js objects directly.
I have extended HTMLarea._lc() that it reads possible variables directly from the string. Example:
- You have the I18N constant "Some text with $variable" : "Some other language text with $variable".
- You want $variable to be replaced with "replaced text".
- You pass to the function as first argument "Some text with $variable=replaced text$".
The _lc parser will grab the variable definition from between the $ signs and builds the appropriate object from it
- as the result $variable is correctly replaced in both languages