mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-11 22:03:09 -06:00
Core: Support for secondary .tr language
git-svn-id: svn://ultimatepp.org/upp/trunk@4141 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
1368067b82
commit
e4feff51cd
4 changed files with 22 additions and 8 deletions
|
|
@ -256,12 +256,11 @@ void CommonInit()
|
|||
{
|
||||
i++;
|
||||
int lang = 0;
|
||||
int lang2 = 0;
|
||||
byte charset = CHARSET_UTF8;
|
||||
String fn = "all";
|
||||
if(i < cmd.GetCount())
|
||||
if(cmd[i].GetLength() != 4 && cmd[i].GetLength() != 5)
|
||||
lang = 0;
|
||||
else {
|
||||
if(cmd[i].GetLength() == 4 || cmd[i].GetLength() == 5) {
|
||||
lang = LNGFromText(cmd[i].ToString());
|
||||
fn = cmd[i].ToString();
|
||||
int c = cmd[i][4];
|
||||
|
|
@ -271,13 +270,19 @@ void CommonInit()
|
|||
charset = c - 'A' + CHARSET_ISO8859_1;
|
||||
}
|
||||
fn << ".tr";
|
||||
if(++i < cmd.GetCount() && (cmd[i].GetLength() == 4 || cmd[i].GetLength() == 5))
|
||||
lang2 = LNGFromText(cmd[i].ToString());
|
||||
#ifdef PLATFORM_WIN32
|
||||
FileOut out(GetExeDirFile(fn));
|
||||
#else
|
||||
FileOut out(GetHomeDirFile(fn));
|
||||
#endif
|
||||
if(lang)
|
||||
SaveLngFile(out, SetLNGCharset(lang, charset));
|
||||
if(lang) {
|
||||
if(lang2)
|
||||
SaveLngFile(out, SetLNGCharset(lang, charset), SetLNGCharset(lang2, charset));
|
||||
else
|
||||
SaveLngFile(out, SetLNGCharset(lang, charset));
|
||||
}
|
||||
else {
|
||||
Index<int> l = GetLngSet();
|
||||
for(int i = 0; i < l.GetCount(); i++)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ String GetLngString(int lang, const char *id);
|
|||
|
||||
Index<int> GetLngSet();
|
||||
Index<int> GetLngSet(const String& module);
|
||||
void SaveLngFile(FileOut& out, int lang);
|
||||
void SaveLngFile(FileOut& out, int lang, int lang2 = 0);
|
||||
bool LoadLngFile(const char *file);
|
||||
|
||||
void SetCurrentLanguage(int lang);
|
||||
|
|
|
|||
|
|
@ -133,13 +133,20 @@ letter character set encoding according this table:&]
|
|||
[s0; &]
|
||||
[s0; example:&]
|
||||
[s0; &]
|
||||
[s7; theide `-`-export`-tr dede2&]
|
||||
[s7; myapp `-`-export`-tr dede2&]
|
||||
[s0; &]
|
||||
[s0; will create dede2.tr file (in exe directory on Win32 and `~/.theide
|
||||
on Posix) ready for translation to deDE in windows`-1252. If
|
||||
translations are already present, they are supplied, otherwise
|
||||
.tr file contains empty strings in place of translations.&]
|
||||
[s0; &]
|
||||
[s0; It is also possible to output secondary already translated language
|
||||
to .tr file as comments (e.g. in case that translator cannot
|
||||
understand english, but can understand some other language):&]
|
||||
[s0; &]
|
||||
[s0; &]
|
||||
[s7; myapp `-`-export`-tr dede2 cscz&]
|
||||
[s0; &]
|
||||
[s0; Each U`+`+ application performs search for .tr files at startup
|
||||
and uses them to extend internal translation tables.&]
|
||||
[s0; &]
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ Index<int> GetLngSet(const String& module)
|
|||
return ndx;
|
||||
}
|
||||
|
||||
void SaveLngFile(FileOut& out, int lang)
|
||||
void SaveLngFile(FileOut& out, int lang, int lang2)
|
||||
{
|
||||
CriticalSection::Lock __(slng);
|
||||
out << "LANGUAGE " << AsCString(LNGAsText(lang)) << ";\r\n";
|
||||
|
|
@ -329,6 +329,8 @@ void SaveLngFile(FileOut& out, int lang)
|
|||
out << "// " << m.name << "\r\n";
|
||||
for(int j = 0; j < m.map.GetCount(); j++) {
|
||||
String id = m.map.GetKey(j).s;
|
||||
if (lang2)
|
||||
out << "// " << AsCString(GetLngString_(lang2, id), 60, "\t", ASCSTRING_SMART) << "\r\n";
|
||||
out << AsCString(id, 70) << ",\r\n"
|
||||
<< "\t" << AsCString(GetLngString_(lang, id), 60, "\t", ASCSTRING_SMART)
|
||||
<< ";\r\n\r\n";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue