MCPcopy Create free account
hub / github.com/totaljs/framework / localize

Function localize

internal.js:1694–1719  ·  view source on GitHub ↗
(language, command)

Source from the content-addressed store, hash-verified

1692
1693// Escaping ", ' and ` chars
1694function localize(language, command) {
1695
1696 !language && (language = 'default');
1697
1698 if (F.resources[language] && F.resources[language].$empty)
1699 return command.command;
1700
1701 var output = F.translate(language, command.command);
1702
1703 if (command.escape) {
1704 var index = 0;
1705 while (true) {
1706 index = output.indexOf(command.escape, index);
1707 if (index === -1)
1708 break;
1709 var c = output[index - 1];
1710 if (c !== '\\') {
1711 output = output.substring(0, index) + '\\' + output.substring(index);
1712 index++;
1713 } else
1714 index += 2;
1715 }
1716 }
1717
1718 return output;
1719}
1720
1721var VIEW_IF = { 'if ': 1, 'if(': 1 };
1722

Callers 1

view_parse_localizationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected