/usr/share/stellarium/scripts/translation.inc is in stellarium-data 0.14.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | //
// Name: Provide simple translation option for scripts
// License: Public Domain
// Author: Matthew Gates
// Description: Simple translation functions for scripts.
// set translations with the setTr function, then use tr(string)
// everywhere in your script where you want to get a translated
// string. The current application language is taken from the
// Application Language setting. See core.setAppLanguage and
// core.getAppLanguage for details.
//
// declare a global variable to store saved state
var translationStrings = new Array();
// call this function with some string ID
function tr(str)
{
lang = core.getAppLanguage();
// core.debug("tr: getting " + lang + " translation for " + str);
if (translationStrings[lang]==undefined)
{
// core.debug("tr: no lang array");
return str;
}
else if (translationStrings[lang][str]==undefined)
{
// core.debug("tr: no phrase array");
return str;
}
else
{
// core.debug("tr: got it");
return translationStrings[lang][str];
}
}
function setTr(lang, original, translation)
{
// core.debug("setTr: " + lang + ", " + original + ", " + translation);
if (translationStrings[lang]==undefined)
{
// core.debug("setTr: making new lang array");
translationStrings[lang] = new Array();
}
translationStrings[lang][original] = translation;
}
function dumpTr()
{
core.debug("We have the following translations:");
for (lang in translationStrings)
{
core.debug("Language: " + lang);
strings = translationStrings[lang];
for (phrase in strings)
{
core.debug(" - " + phrase + " -> " + strings[phrase]);
}
}
}
|