added Ukrainian translation

pull/1/head
Michael Peter Christen 13 years ago
parent 1a0b6b3913
commit 190b77c55e

@ -35,7 +35,8 @@
<input type="radio" name="language" value="de" id="lang_de" onchange="this.form.submit()" #(lang_de)#::checked="checked"#(/lang_de)# /><label for="lang_de">Deutsch</label>&nbsp; <input type="radio" name="language" value="de" id="lang_de" onchange="this.form.submit()" #(lang_de)#::checked="checked"#(/lang_de)# /><label for="lang_de">Deutsch</label>&nbsp;
<input type="radio" name="language" value="fr" id="lang_fr" onchange="this.form.submit()" #(lang_fr)#::checked="checked"#(/lang_fr)# /><label for="lang_fr">Fran&ccedil;ais</label>&nbsp; <input type="radio" name="language" value="fr" id="lang_fr" onchange="this.form.submit()" #(lang_fr)#::checked="checked"#(/lang_fr)# /><label for="lang_fr">Fran&ccedil;ais</label>&nbsp;
<input type="radio" name="language" value="cn" id="lang_cn" onchange="this.form.submit()" #(lang_cn)#::checked="checked"#(/lang_cn)# /><label for="lang_cn">&#27721;&#35821;/&#28450;&#35486</label> <input type="radio" name="language" value="cn" id="lang_cn" onchange="this.form.submit()" #(lang_cn)#::checked="checked"#(/lang_cn)# /><label for="lang_cn">&#27721;&#35821;/&#28450;&#35486</label>
<input type="radio" name="language" value="ru" id="lang_ru" onchange="this.form.submit()" #(lang_ru)#::checked="checked"#(/lang_ru)# /><label for="lang_ru">Russian</label> <input type="radio" name="language" value="ru" id="lang_ru" onchange="this.form.submit()" #(lang_ru)#::checked="checked"#(/lang_ru)# /><label for="lang_ru">&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;</label>
<input type="radio" name="language" value="uk" id="lang_uk" onchange="this.form.submit()" #(lang_uk)#::checked="checked"#(/lang_uk)# /><label for="lang_uk">&#1059;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;</label>
<input type="radio" name="language" value="default" id="lang_en" onchange="this.form.submit()" #(lang_en)#::checked="checked"#(/lang_en)# /><label for="lang_en">English</label> <input type="radio" name="language" value="default" id="lang_en" onchange="this.form.submit()" #(lang_en)#::checked="checked"#(/lang_en)# /><label for="lang_en">English</label>
</fieldset> </fieldset>
</li> </li>

@ -267,6 +267,7 @@ public class ConfigBasic {
prop.put("lang_fr", "0"); prop.put("lang_fr", "0");
prop.put("lang_cn", "0"); prop.put("lang_cn", "0");
prop.put("lang_ru", "0"); prop.put("lang_ru", "0");
prop.put("lang_uk", "0");
prop.put("lang_en", "0"); prop.put("lang_en", "0");
if ("default".equals(lang)) { if ("default".equals(lang)) {
prop.put("lang_en", "1"); prop.put("lang_en", "1");

File diff suppressed because one or more lines are too long

@ -1,4 +1,4 @@
// translator.java // translator.java
// ------------------------------------- // -------------------------------------
// part of YACY // part of YACY
// (C) by Michael Peter Christen; mc@yacy.net // (C) by Michael Peter Christen; mc@yacy.net
@ -59,7 +59,7 @@ import de.anomic.server.serverSwitch;
public class Translator { public class Translator {
public final static String LANG_FILENAME_FILTER = "^.*\\.lng$"; public final static String LANG_FILENAME_FILTER = "^.*\\.lng$";
public static String translate(final String source, final Map<String, String> translationTable){ public static String translate(final String source, final Map<String, String> translationTable){
final Set<String> keys = translationTable.keySet(); final Set<String> keys = translationTable.keySet();
String result = source; String result = source;
@ -76,7 +76,7 @@ public class Translator {
} }
return result; return result;
} }
/** /**
* Load multiple translationLists from one File. Each List starts with #File: relative/path/to/file * Load multiple translationLists from one File. Each List starts with #File: relative/path/to/file
* @param translationFile the File, which contains the Lists * @param translationFile the File, which contains the Lists
@ -119,7 +119,7 @@ public class Translator {
public static boolean translateFile(final File sourceFile, final File destFile, final File translationFile){ public static boolean translateFile(final File sourceFile, final File destFile, final File translationFile){
return translateFile(sourceFile, destFile, loadTranslationsLists(translationFile).get(sourceFile.getName())); return translateFile(sourceFile, destFile, loadTranslationsLists(translationFile).get(sourceFile.getName()));
} }
public static boolean translateFile(final File sourceFile, final File destFile, final Map<String, String> translationList){ public static boolean translateFile(final File sourceFile, final File destFile, final Map<String, String> translationList){
StringBuilder content = new StringBuilder(); StringBuilder content = new StringBuilder();
@ -140,7 +140,7 @@ public class Translator {
} catch (final Exception e) {} } catch (final Exception e) {}
} }
} }
content = new StringBuilder(translate(content.toString(), translationList)); content = new StringBuilder(translate(content.toString(), translationList));
BufferedWriter bw = null; BufferedWriter bw = null;
try{ try{
@ -156,7 +156,7 @@ public class Translator {
} catch (final Exception e) {} } catch (final Exception e) {}
} }
} }
return true; return true;
} }
@ -185,7 +185,7 @@ public class Translator {
} catch (final IndexOutOfBoundsException e) { } catch (final IndexOutOfBoundsException e) {
Log.logSevere("TRANSLATOR", "Error creating relative Path for "+sourceFile.getAbsolutePath()); Log.logSevere("TRANSLATOR", "Error creating relative Path for "+sourceFile.getAbsolutePath());
relativePath = "wrong path"; //not in translationLists relativePath = "wrong path"; //not in translationLists
} }
if (translationLists.containsKey(relativePath)) { if (translationLists.containsKey(relativePath)) {
Log.logInfo("TRANSLATOR", "Translating file: "+ relativePath); Log.logInfo("TRANSLATOR", "Translating file: "+ relativePath);
if(!translateFile( if(!translateFile(
@ -217,7 +217,11 @@ public class Translator {
} }
public static Map<String, String> langMap(final serverSwitch env) { public static Map<String, String> langMap(final serverSwitch env) {
final String[] ms = "default/English,de/Deutsch,fr/Fran&ccedil;ais,nl/Nederlands,it/Italiano,es/Espa&ntilde;ol,pt/Portug&ecirc;s,fi/Suomi,se/Svenska,dk/Dansk,gr/E&lambda;&lambda;&eta;v&iota;&kappa;&alpha;,sk/Slovensky,cn/&#27721;&#35821;/&#28450;&#35486;".split(","); final String[] ms = (
"default/English,de/Deutsch,fr/Fran&ccedil;ais,nl/Nederlands,it/Italiano,es/Espa&ntilde;ol,pt/Portug&ecirc;s,fi/Suomi,se/Svenska,dk/Dansk," +
"gr/E&lambda;&lambda;&eta;v&iota;&kappa;&alpha;,sk/Slovensky,cn/&#27721;&#35821;/&#28450;&#35486;," +
"ru/&#1056;&#1091;&#1089;&#1089;&#1082;&#1080;&#1081;,uk/&#1059;&#1082;&#1088;&#1072;&#1111;&#1085;&#1089;&#1100;&#1082;&#1072;"
).split(",");
final Map<String, String> map = new HashMap<String, String>(); final Map<String, String> map = new HashMap<String, String>();
for (final String element : ms) { for (final String element : ms) {
int p = element.indexOf('/'); int p = element.indexOf('/');
@ -226,7 +230,7 @@ public class Translator {
} }
return map; return map;
} }
public static boolean changeLang(final serverSwitch env, final File langPath, final String lang) { public static boolean changeLang(final serverSwitch env, final File langPath, final String lang) {
boolean ret = false; boolean ret = false;
@ -258,7 +262,7 @@ public class Translator {
} }
return ret; return ret;
} }
public static List<String> langFiles(File langPath) { public static List<String> langFiles(File langPath) {
return FileUtils.getDirListing(langPath, Translator.LANG_FILENAME_FILTER); return FileUtils.getDirListing(langPath, Translator.LANG_FILENAME_FILTER);
} }

Loading…
Cancel
Save