1
// Set properties of the phrase given by the finalized msgstr in the PO file.
2
// The arguments to the call are consecutive pairs of keys and values,
3
// as many as needed (i.e. total number of arguments must be even).
5
// The property keys are registered as PO calls taking single argument,
6
// which can be used to retrive the property values for this msgstr
7
// when it is later used as placeholder replacement in another message.
9
// Always signals fallback.
11
function setMsgstrProps (/*KEY1, VALUE1, ...*/)
13
if (arguments.length % 2 != 0)
14
throw Error("Property setter given odd number of arguments.");
16
// Collect finalized msgstr.
19
// Go through all key-value pairs.
20
for (var i = 0; i < arguments.length; i += 2) {
21
var pkey = arguments[i];
22
var pval = arguments[i + 1];
24
// Set the value of the property for this phrase.
25
Ts.setProp(phrase, pkey, pval);
27
// Set the PO call for getting this property, if not already set.
28
if (!Ts.hascall(pkey)) {
30
function (phr) { return Ts.getProp(phr, this.pkey) },
37
Ts.setcall("eigenskap", setMsgstrProps);
38
// NOTE: You can replace "properties" in the line above with any UTF-8 string,
39
// e.g. one in your language so that it blends nicely inside POs.