Commit cee1b9e9 authored by claes's avatar claes

Local language files added

parent 75d4393f
/** /**
* Proview $Id: co_lng.cpp,v 1.14 2007-10-30 07:46:45 claes Exp $ * Proview $Id: co_lng.cpp,v 1.15 2008-02-05 13:15:48 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -221,28 +221,37 @@ void Lng::unload() ...@@ -221,28 +221,37 @@ void Lng::unload()
bool Lng::read() bool Lng::read()
{ {
char fname1[120] = "$pwr_exe/en_us/xtt_lng.dat"; char fname1[120];
char fname2[120] = "$pwr_exe/%s/xtt_lng.dat"; char fname2[120];
pwr_tFileName filename1, filename2; pwr_tFileName filename1, filename2;
int sts; int sts;
if ( tree)
tree_DeleteTable( &sts, tree);
tree = tree_CreateTable( &sts, sizeof(lang_sKey), offsetof(lang_sRecord, key),
sizeof(lang_sRecord), 100, compKey);
for ( int i = 0; i < 2; i++) {
if ( i == 0) {
strcpy( fname1, "$pwr_exe/en_us/xtt_lng.dat");
strcpy( fname2, "$pwr_exe/%s/xtt_lng.dat");
}
else {
strcpy( fname1, "$pwrp_exe/xtt_lng_en_us.dat");
strcpy( fname2, "$pwrp_exe/xtt_lng_%s.dat");
}
sprintf( filename2, fname2, get_language_str()); sprintf( filename2, fname2, get_language_str());
dcli_translate_filename( filename1, fname1); dcli_translate_filename( filename1, fname1);
dcli_translate_filename( filename2, filename2); dcli_translate_filename( filename2, filename2);
ifstream fp1( filename1); ifstream fp1( filename1);
if ( !fp1) if ( !fp1)
return false; return i == 0 ? false : true;
ifstream fp2( filename2); ifstream fp2( filename2);
if ( !fp2) if ( !fp2)
return false; return i == 0 ? false : true;
if ( tree)
tree_DeleteTable( &sts, tree);
tree = tree_CreateTable( &sts, sizeof(lang_sKey), offsetof(lang_sRecord, key),
sizeof(lang_sRecord), 100, compKey);
Row r1( fp1, fname1); Row r1( fp1, fname1);
Row r2( fp2, fname2); Row r2( fp2, fname2);
...@@ -279,6 +288,7 @@ bool Lng::read() ...@@ -279,6 +288,7 @@ bool Lng::read()
// printf ( "%c %d.%d.%d '%s' '%s'\n", r1.type, r1.n1, r1.n2, r1.n3, r1.text,r2.text); // printf ( "%c %d.%d.%d '%s' '%s'\n", r1.type, r1.n1, r1.n2, r1.n3, r1.text,r2.text);
} }
} }
}
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment