提交 77c5c942 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 4e0a8dbb
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
90006=NULL not allowed for column {0} 90006=NULL not allowed for column {0}
90007=The object is already closed 90007=The object is already closed
90008=Invalid value {0} for parameter {1} 90008=Invalid value {0} for parameter {1}
90009=Cannot parse date constant {0} 90009=Cannot parse date constant {0}, cause\: {1}
90010=Cannot parse time constant {0} 90010=Cannot parse time constant {0}, cause\: {1}
90011=Cannot parse timestamp constant {0} 90011=Cannot parse timestamp constant {0}, cause\: {1}
90012=Parameter {0} is not set 90012=Parameter {0} is not set
90013=Database {0} not found 90013=Database {0} not found
90014=Error parsing {0} 90014=Error parsing {0}
...@@ -46,15 +46,15 @@ ...@@ -46,15 +46,15 @@
90023=Column {0} must not be nullable 90023=Column {0} must not be nullable
90024=Error while renaming file {0} to {1} 90024=Error while renaming file {0} to {1}
90025=Cannot delete file {0} 90025=Cannot delete file {0}
90026=Serialization failed 90026=Serialization failed, cause\: {0}
90027=Deserialization failed 90027=Deserialization failed, cause\: {0}
90028=IO Exception\: {0} 90028=IO Exception\: {0}
90029=Currently not on an updatable row 90029=Currently not on an updatable row
90030=File corrupted while reading record\: {0}. Possible solution\: use the recovery tool 90030=File corrupted while reading record\: {0}. Possible solution\: use the recovery tool
90031=IO Exception\: {0}; {1} 90031=IO Exception\: {0}; {1}
90032=User {0} not found 90032=User {0} not found
90033=User {0} already exists 90033=User {0} already exists
90034=Log file error\: {0} 90034=Log file error\: {0}, cause\: {1}
90035=Sequence {0} already exists 90035=Sequence {0} already exists
90036=Sequence {0} not found 90036=Sequence {0} not found
90037=View {0} not found 90037=View {0} not found
...@@ -63,8 +63,8 @@ ...@@ -63,8 +63,8 @@
90040=Admin rights are required for this operation 90040=Admin rights are required for this operation
90041=Trigger {0} already exists 90041=Trigger {0} already exists
90042=Trigger {0} not found 90042=Trigger {0} not found
90043=Error creating or initializing trigger {0} object, class {1}; see root cause for details 90043=Error creating or initializing trigger {0} object, class {1}, cause\: {2}; see root cause for details
90044=Error executing trigger {0}, class {1}; see root cause for details 90044=Error executing trigger {0}, class {1}, cause \: {2}; see root cause for details
90045=Constraint {0} already exists 90045=Constraint {0} already exists
90046=URL format error; must be {0} but is {1} 90046=URL format error; must be {0} but is {1}
90047=Version mismatch, driver version is {0} but server version is {1} 90047=Version mismatch, driver version is {0} but server version is {1}
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
90058=Duplicate table or table alias {0} 90058=Duplicate table or table alias {0}
90059=Ambiguous column name {0} 90059=Ambiguous column name {0}
90060=Unsupported file lock method {0} 90060=Unsupported file lock method {0}
90061=Exception opening port {0} (port may be in use) 90061=Exception opening port {0} (port may be in use), cause\: {1}
90062=Error while creating file {0} 90062=Error while creating file {0}
90063=Savepoint is invalid\: {0} 90063=Savepoint is invalid\: {0}
90064=Savepoint is unnamed 90064=Savepoint is unnamed
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
90096=Not enough rights for object {0} 90096=Not enough rights for object {0}
90097=The database is read only 90097=The database is read only
90098=The database has been closed 90098=The database has been closed
90099=Error setting database event listener {0} 90099=Error setting database event listener {0}, cause\: {1}
90100=No disk space available 90100=No disk space available
90101=Wrong XID format\: {0} 90101=Wrong XID format\: {0}
90102=Unsupported compression options\: {0} 90102=Unsupported compression options\: {0}
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
90108=Stack overflow (recursive query or function?) 90108=Stack overflow (recursive query or function?)
90109=View {0} is invalid\: {1} 90109=View {0} is invalid\: {1}
90110={0} out of range 90110={0} out of range
90111=Error accessing linked table with SQL statement {0} 90111=Error accessing linked table with SQL statement {0}, cause\: {1}
90112=Row not found when trying to delete from index {0} 90112=Row not found when trying to delete from index {0}
90113=Unsupported connection setting {0} 90113=Unsupported connection setting {0}
90114=Constant {0} already exists 90114=Constant {0} already exists
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
90006=NULL nicht zul\u00E4ssig f\u00FCr Feld {0} 90006=NULL nicht zul\u00E4ssig f\u00FCr Feld {0}
90007=Das Objekt wurde bereits geschlossen 90007=Das Objekt wurde bereits geschlossen
90008=Unerlaubter Wert {0} f\u00FCr Parameter {1} 90008=Unerlaubter Wert {0} f\u00FCr Parameter {1}
90009=Kann Datum {0} nicht umwandeln 90009=Kann Datum {0} nicht umwandeln, Grund\: {1}
90010=Kann Zeit {0} nicht umwandeln 90010=Kann Zeit {0} nicht umwandeln, Grund\: {1}
90011=Kann Zeitstempel {0} nicht umwandeln 90011=Kann Zeitstempel {0} nicht umwandeln, Grund\: {1}
90012=Parameter {0} wurde nicht gesetzt 90012=Parameter {0} wurde nicht gesetzt
90013=Datenbank {0} nicht gefunden 90013=Datenbank {0} nicht gefunden
90014=Fehler beim Parsen von {0} 90014=Fehler beim Parsen von {0}
...@@ -46,15 +46,15 @@ ...@@ -46,15 +46,15 @@
90023=Feld {0} darf nicht NULL nicht erlauben 90023=Feld {0} darf nicht NULL nicht erlauben
90024=Fehler beim Umbenennen der Datei {0} nach {1} 90024=Fehler beim Umbenennen der Datei {0} nach {1}
90025=Kann Datei {0} nicht l\u00F6schen 90025=Kann Datei {0} nicht l\u00F6schen
90026=Serialisierung fehlgeschlagen 90026=Serialisierung fehlgeschlagen, Grund\: {}
90027=De-Serialisierung fehlgeschlagen 90027=De-Serialisierung fehlgeschlagen, Grund\: {1}
90028=Eingabe/Ausgabe Fehler\: {0} 90028=Eingabe/Ausgabe Fehler\: {0}
90029=Im Moment nicht auf einer ver\u00E4nderbaren Zeile 90029=Im Moment nicht auf einer ver\u00E4nderbaren Zeile
90030=Datei fehlerhaft beim Lesen des Datensatzes\: {0}. M\u00F6gliche L\u00F6sung\: Recovery Werkzeug verwenden 90030=Datei fehlerhaft beim Lesen des Datensatzes\: {0}. M\u00F6gliche L\u00F6sung\: Recovery Werkzeug verwenden
90031=Eingabe/Ausgabe\: {0}; {1} 90031=Eingabe/Ausgabe\: {0}; {1}
90032=Benutzer {0} nicht gefunden 90032=Benutzer {0} nicht gefunden
90033=Benutzer {0} besteht bereits 90033=Benutzer {0} besteht bereits
90034=Log Datei error\: {0} 90034=Log Datei Fehler\: {0}, Grund\: {1}
90035=Sequenz {0} besteht bereits 90035=Sequenz {0} besteht bereits
90036=Sequenz {0} nicht gefunden 90036=Sequenz {0} nicht gefunden
90037=View {0} nicht gefunden 90037=View {0} nicht gefunden
...@@ -63,8 +63,8 @@ ...@@ -63,8 +63,8 @@
90040=F\u00FCr diese Operation werden Administrator-Rechte ben\u00F6tigt 90040=F\u00FCr diese Operation werden Administrator-Rechte ben\u00F6tigt
90041=Trigger {0} besteht bereits 90041=Trigger {0} besteht bereits
90042=Trigger {0} nicht gefunden 90042=Trigger {0} nicht gefunden
90043=Fehler beim Erzeugen des Triggers {0}, Klasse {1}; siehe Ursache f\u00FCr Details 90043=Fehler beim Erzeugen des Triggers {0}, Klasse {1}, Grund\: {1}; siehe Ursache f\u00FCr Details
90044=Fehler beim Ausf\u00FChren des Triggers {0}, Klasse {1}; siehe Ursache f\u00FCr Details 90044=Fehler beim Ausf\u00FChren des Triggers {0}, Klasse {1}, Grund\: {1}; siehe Ursache f\u00FCr Details
90045=Bedingung {0} besteht bereits 90045=Bedingung {0} besteht bereits
90046=URL Format Fehler; erwartet {0}, erhalten {1} 90046=URL Format Fehler; erwartet {0}, erhalten {1}
90047=Falsche Version, Treiber Version ist {0}, Server Version ist {1} 90047=Falsche Version, Treiber Version ist {0}, Server Version ist {1}
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
90058=Doppelter Tabellen- oder Alias-Name {0} 90058=Doppelter Tabellen- oder Alias-Name {0}
90059=Mehrdeutiger Feldname {0} 90059=Mehrdeutiger Feldname {0}
90060=Ung\u00FCltige Datei-Sperr-Methode {0} 90060=Ung\u00FCltige Datei-Sperr-Methode {0}
90061=Fehler beim \u00D6ffnen von Port {0} (Port wird ev. bereits verwendet) 90061=Fehler beim \u00D6ffnen von Port {0} (Port wird ev. bereits verwendet), Grund\: {1}
90062=Fehler beim Erzeugen der Datei {0} 90062=Fehler beim Erzeugen der Datei {0}
90063=Savepoint ist ung\u00FCltig\: {0} 90063=Savepoint ist ung\u00FCltig\: {0}
90064=Savepoint hat keinen Namen 90064=Savepoint hat keinen Namen
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
90096=Nicht genug Rechte f\u00FCr Objekt {0} 90096=Nicht genug Rechte f\u00FCr Objekt {0}
90097=Die Datenbank ist schreibgesch\u00FCtzt 90097=Die Datenbank ist schreibgesch\u00FCtzt
90098=Die Datenbank ist bereits geschlossen 90098=Die Datenbank ist bereits geschlossen
90099=Fehler beim Setzen des Datenbank Ereignis Empf\u00E4ngers {0} 90099=Fehler beim Setzen des Datenbank Ereignis Empf\u00E4ngers {0}, Grund\: {1}
90100=Kein Festplatten Speicherplatz verf\u00FCgbar 90100=Kein Festplatten Speicherplatz verf\u00FCgbar
90101=Falsches XID Format\: {0} 90101=Falsches XID Format\: {0}
90102=Datenkompressions-Option nicht unterst\u00FCtzt\: {0} 90102=Datenkompressions-Option nicht unterst\u00FCtzt\: {0}
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
90108=Stack\u00FCberlauf (Rekursive Abfrage oder Funktion?) 90108=Stack\u00FCberlauf (Rekursive Abfrage oder Funktion?)
90109=View {0} ist ung\u00FCltig\: {1} 90109=View {0} ist ung\u00FCltig\: {1}
90110={0} ausserhalb des Bereichts 90110={0} ausserhalb des Bereichts
90111=Fehler beim Zugriff auf eine verkn\u00FCpfte Tabelle mit SQL Befehl {0} 90111=\Fehler beim Zugriff auf eine verkn\u00FCpfte Tabelle mit SQL Befehl {0}, Grund\: {1}
90112=Zeile nicht gefunden beim L\u00F6schen von Index {0} 90112=Zeile nicht gefunden beim L\u00F6schen von Index {0}
90113=Datenbank-Verbindungs Option {0} nicht unterst\u00FCtzt 90113=Datenbank-Verbindungs Option {0} nicht unterst\u00FCtzt
90114=Konstante {0} besteht bereits 90114=Konstante {0} besteht bereits
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
90006=Pole nie moze byc puste {0} 90006=Pole nie moze byc puste {0}
90007=Objekt jest zamkniety 90007=Objekt jest zamkniety
90008=Nieprawidlowa wartosc {0} parametru {1} 90008=Nieprawidlowa wartosc {0} parametru {1}
90009=Nie mozna parsowac stalej daty {0} 90009=\#Cannot parse date constant {0}, cause\: {1} \#Nie mozna parsowac stalej daty {0}
90010=Nie mozna parsowac stalej czasu {0} 90010=\#Cannot parse time constant {0}, cause\: {1} \#Nie mozna parsowac stalej czasu {0}
90011=Nie mozna parsowac stalej stepla czasu {0} 90011=\#Cannot parse timestamp constant {0}, cause\: {1} \#Nie mozna parsowac stalej stepla czasu {0}
90012=Parametr o numerze {0} nie jest ustalony 90012=Parametr o numerze {0} nie jest ustalony
90013=Baza danych {0} nie znaleziona 90013=Baza danych {0} nie znaleziona
90014=Blad parsowania {0} 90014=Blad parsowania {0}
...@@ -46,15 +46,15 @@ ...@@ -46,15 +46,15 @@
90023=Kolumna Column {0} nie moze zawierac wartosci pustej 90023=Kolumna Column {0} nie moze zawierac wartosci pustej
90024=Blad w zmianie nazwy pliku {0} na {1} 90024=Blad w zmianie nazwy pliku {0} na {1}
90025=Nie mozna skasowac pliku {0} 90025=Nie mozna skasowac pliku {0}
90026=Blad serializacji 90026=\#Serialization failed, cause\: {0} \#Blad serializacji
90027=Blad deserializacji 90027=\#Deserialization failed, cause\: {0} \#Blad deserializacji
90028=Blad wejscia/wyjscia\: {0} 90028=Blad wejscia/wyjscia\: {0}
90029=Aktualny rekord nie pozwala na aktualizacje 90029=Aktualny rekord nie pozwala na aktualizacje
90030=Uszkodzenie pliku podczas wczytywania rekordu\: {0} 90030=Uszkodzenie pliku podczas wczytywania rekordu\: {0}
90031=Polaczenie nie zostalo zamkniete 90031=Polaczenie nie zostalo zamkniete
90032=Uzytkownik {0} nie istnieje 90032=Uzytkownik {0} nie istnieje
90033=Uzytkownik {0} juz istnieje 90033=Uzytkownik {0} juz istnieje
90034=Blad pliku logu\: {0} 90034=\#Log file error\: {0}, cause\: {1} \#Blad pliku logu\: {0}
90035=Sekwencja {0} juz istnieje 90035=Sekwencja {0} juz istnieje
90036=Sekwencja {0} nie istnieje 90036=Sekwencja {0} nie istnieje
90037=Widok {0} nie istnieje 90037=Widok {0} nie istnieje
...@@ -63,8 +63,8 @@ ...@@ -63,8 +63,8 @@
90040=Uprawnienia administratora sa wymagane do wykonania tej operacji 90040=Uprawnienia administratora sa wymagane do wykonania tej operacji
90041=Wyzwalacz {0} juz istnieje 90041=Wyzwalacz {0} juz istnieje
90042=Wyzwalacz {0} nie istnieje 90042=Wyzwalacz {0} nie istnieje
90043=\#Blad tworzenia wyzwalacza, obiekt {0}, klasa {1} 90043=\#Error creating or initializing trigger {0} object, class {1}, cause\: {2}; see root cause for details \#\#Blad tworzenia wyzwalacza, obiekt {0}, klasa {1}
90044=\#Blad wykonania wyzwalacza, obiekt {0}, klasa {1} 90044=\#Error executing trigger {0}, class {1}, cause \: {2}; see root cause for details \#\#Blad wykonania wyzwalacza, obiekt {0}, klasa {1}
90045=Ograniczenie {0} juz istnieje 90045=Ograniczenie {0} juz istnieje
90046=Bledny format URL; powinno byc {0} a jest {1} 90046=Bledny format URL; powinno byc {0} a jest {1}
90047=Niezgodna wersja sterownika, aktualna werjsa to {0} a wersja serwera to {1} 90047=Niezgodna wersja sterownika, aktualna werjsa to {0} a wersja serwera to {1}
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
90058=Zduplikowana tabela lub alias tabeli {0} 90058=Zduplikowana tabela lub alias tabeli {0}
90059=Niejednoznaczna nazwa kolumny {0} 90059=Niejednoznaczna nazwa kolumny {0}
90060=Niewspierana metoda blokowania pliku {0} 90060=Niewspierana metoda blokowania pliku {0}
90061=Blad otwarcia portu {0} (prawdopodobnie port jest w uzyciu) 90061=\#Exception opening port {0} (port may be in use), cause\: {1} \#Blad otwarcia portu {0} (prawdopodobnie port jest w uzyciu)
90062=Blad tworzenia pliku {0} 90062=Blad tworzenia pliku {0}
90063=Zakladka jest nieprawidlowa\: {0} 90063=Zakladka jest nieprawidlowa\: {0}
90064=Zakladka jest bez nazwy 90064=Zakladka jest bez nazwy
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
90096=Brak wystarczajacych praw do obiektu {0} 90096=Brak wystarczajacych praw do obiektu {0}
90097=Baza danych jest w trybie tylko do odczytu 90097=Baza danych jest w trybie tylko do odczytu
90098=Baza danych zostala zamknieta 90098=Baza danych zostala zamknieta
90099=Blad ustawienia sluchacza zdarzen bazy danych {0} 90099=\#Error setting database event listener {0}, cause\: {1} \#Blad ustawienia sluchacza zdarzen bazy danych {0}
90100=Brak miejsca na dysku 90100=Brak miejsca na dysku
90101=Zly format XID\: {0} 90101=Zly format XID\: {0}
90102=Nie wspierana opcja kompresji\: {0} 90102=Nie wspierana opcja kompresji\: {0}
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
90108=Przepelnienie stosu (rekursywna kwerenda lub funkcja?) 90108=Przepelnienie stosu (rekursywna kwerenda lub funkcja?)
90109=Widok {0} jest nieprawidlowy 90109=Widok {0} jest nieprawidlowy
90110={0} poza zakresem 90110={0} poza zakresem
90111=Blad dostepu do podlaczonej tabeli w wyrazeniu SQL {0} 90111=\#Error accessing linked table with SQL statement {0}, cause\: {1} \#Blad dostepu do podlaczonej tabeli w wyrazeniu SQL {0}
90112=Rekord nie znaleziony przy probie kasowania z indeksu {0} 90112=Rekord nie znaleziony przy probie kasowania z indeksu {0}
90113=Ni ewspierana opcja polaczenia {0} 90113=Ni ewspierana opcja polaczenia {0}
90114=Stala {0} juz istnieje 90114=Stala {0} juz istnieje
......
...@@ -97,6 +97,8 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2 ...@@ -97,6 +97,8 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
strict xhtml (javadocs,...) strict xhtml (javadocs,...)
make docs translatable make docs translatable
add to maven
docs: CACHE_SIZE=200000 maybe too much? docs: CACHE_SIZE=200000 maybe too much?
Add version number. Install directory: h2-1.0, jar file: h2-1.0.jar Add version number. Install directory: h2-1.0, jar file: h2-1.0.jar
......
...@@ -30,20 +30,51 @@ public class PrepareTranslation { ...@@ -30,20 +30,51 @@ public class PrepareTranslation {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String baseDir = "src/docsrc/textbase"; String baseDir = "src/docsrc/textbase";
String path; prepare(baseDir, "src/main/org/h2/res");
path = "src/main/org/h2/res"; prepare(baseDir, "src/main/org/h2/server/web/res");
prepare(baseDir, path);
path = "src/main/org/h2/server/web/res"; // convert the txt files to properties files
prepare(baseDir, path); PropertiesToUTF8.textUTF8ToProperties("src/docsrc/text/_docs_de.utf8.txt", "src/docsrc/text/_docs_de.properties");
extractFromHtml("src/docsrc/html", "src/docsrc/text"); // PropertiesToUTF8.textUTF8ToProperties("src/docsrc/text/_docs_ja.utf8.txt", "src/docsrc/text/_docs_ja.properties");
buildHtml("src/docsrc/text", "docs/html", "ja");
buildHtml("src/docsrc/text", "docs/html", "de"); // create the .jsp files and extract the text in the main language
extractFromHtml("src/docsrc/html", "src/docsrc/text", MAIN_LANGUAGE);
// add missing translations and create a new baseline
prepare(baseDir, "src/docsrc/text");
// create the translated documentation
buildHtml("src/docsrc/text", "docs/html", "en"); buildHtml("src/docsrc/text", "docs/html", "en");
buildHtml("src/docsrc/text", "docs/html", "de");
// buildHtml("src/docsrc/text", "docs/html", "ja");
// convert the properies files back to utf8 text files, including the main lanuage (to be used as a template)
PropertiesToUTF8.propertiesToTextUTF8("src/docsrc/text/_docs_en.properties", "src/docsrc/text/_docs_en.utf8.txt");
PropertiesToUTF8.propertiesToTextUTF8("src/docsrc/text/_docs_de.properties", "src/docsrc/text/_docs_de.utf8.txt");
// PropertiesToUTF8.propertiesToTextUTF8("src/docsrc/text/_docs_ja.properties", "src/docsrc/text/_docs_ja.utf8.txt");
// delete temporary files
File[] list = new File("src/docsrc/text").listFiles();
for(int i=0; i<list.length; i++) {
if(!list[i].getName().endsWith(".utf8.txt")) {
list[i].delete();
}
}
} }
private static void buildHtml(String templateDir, String targetDir, String language) throws IOException { private static void buildHtml(String templateDir, String targetDir, String language) throws IOException {
File[] list = new File(templateDir).listFiles(); File[] list = new File(templateDir).listFiles();
new File(targetDir).mkdirs(); new File(targetDir).mkdirs();
// load the main 'translation'
String propName = templateDir + "/_docs_" + MAIN_LANGUAGE + ".properties";
Properties prop = FileUtils.loadProperties(propName);
propName = templateDir + "/_docs_" + language + ".properties";
if(!(new File(propName)).exists()) {
throw new IOException("Translation not found: " + propName);
}
Properties transProp = FileUtils.loadProperties(propName);
// overload with this language
prop.putAll(transProp);
ArrayList fileNames = new ArrayList(); ArrayList fileNames = new ArrayList();
for(int i=0; i<list.length; i++) { for(int i=0; i<list.length; i++) {
String name = list[i].getName(); String name = list[i].getName();
...@@ -61,13 +92,6 @@ public class PrepareTranslation { ...@@ -61,13 +92,6 @@ public class PrepareTranslation {
} }
// remove '.jsp' // remove '.jsp'
name = name.substring(0, name.length()-4); name = name.substring(0, name.length()-4);
String propName = templateDir + "/" + MAIN_LANGUAGE + "/" + name + "_" + MAIN_LANGUAGE + ".properties";
Properties prop = FileUtils.loadProperties(propName);
propName = templateDir + "/" + language + "/" + name + "_" + language + ".properties";
if((new File(propName)).exists()) {
Properties transProp = FileUtils.loadProperties(propName);
prop.putAll(transProp);
}
String template = IOUtils.readStringAndClose(new FileReader(templateDir + "/" + name + ".jsp"), -1); String template = IOUtils.readStringAndClose(new FileReader(templateDir + "/" + name + ".jsp"), -1);
String html = PageParser.parse(null, template, prop); String html = PageParser.parse(null, template, prop);
html = StringUtils.replaceAll(html, "lang=\""+MAIN_LANGUAGE+"\"", "lang=\""+ language + "\""); html = StringUtils.replaceAll(html, "lang=\""+MAIN_LANGUAGE+"\"", "lang=\""+ language + "\"");
...@@ -75,14 +99,21 @@ public class PrepareTranslation { ...@@ -75,14 +99,21 @@ public class PrepareTranslation {
String n = (String) fileNames.get(j); String n = (String) fileNames.get(j);
html = StringUtils.replaceAll(html, n + ".html\"", n + "_" + language + ".html\""); html = StringUtils.replaceAll(html, n + ".html\"", n + "_" + language + ".html\"");
} }
OutputStream out = new FileOutputStream(targetDir + "/" + name + "_" + language + ".html"); html = StringUtils.replaceAll(html, "_" + MAIN_LANGUAGE + ".html\"", ".html\"");
String target;
if(language.equals(MAIN_LANGUAGE)) {
target = targetDir + "/" + name + ".html";
} else {
target = targetDir + "/" + name + "_" + language + ".html";
}
OutputStream out = new FileOutputStream(target);
OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8"); OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
writer.write(html); writer.write(html);
writer.close(); writer.close();
} }
} }
private static void extractFromHtml(String dir, String target) throws Exception { private static void extractFromHtml(String dir, String target, String language) throws Exception {
File[] list = new File(dir).listFiles(); File[] list = new File(dir).listFiles();
for (int i = 0; i < list.length; i++) { for (int i = 0; i < list.length; i++) {
File f = list[i]; File f = list[i];
...@@ -280,8 +311,11 @@ public class PrepareTranslation { ...@@ -280,8 +311,11 @@ public class PrepareTranslation {
// break; // break;
// } // }
} }
new File(target + "/" + MAIN_LANGUAGE).mkdirs(); new File(target).mkdirs();
PropertiesToUTF8.storeProperties(prop, target + "/" + MAIN_LANGUAGE + "/" + documentName + "_" + MAIN_LANGUAGE + ".properties"); String propFileName = target + "/_docs_" + MAIN_LANGUAGE + ".properties";
Properties old = FileUtils.loadProperties(propFileName);
prop.putAll(old);
PropertiesToUTF8.storeProperties(prop, propFileName);
String t = template.toString(); String t = template.toString();
if(templateIsCopy && !t.equals(xml)) { if(templateIsCopy && !t.equals(xml)) {
for(int i=0; i<Math.min(t.length(), xml.length()); i++) { for(int i=0; i<Math.min(t.length(), xml.length()); i++) {
......
...@@ -33,7 +33,10 @@ public class PropertiesToUTF8 { ...@@ -33,7 +33,10 @@ public class PropertiesToUTF8 {
convert("bin/org/h2/server/web/res", "."); convert("bin/org/h2/server/web/res", ".");
} }
private static void propertiesToTextUTF8(String source, String target) throws Exception { static void propertiesToTextUTF8(String source, String target) throws Exception {
if(!new File(source).exists()) {
return;
}
Properties prop = FileUtils.loadProperties(source); Properties prop = FileUtils.loadProperties(source);
FileOutputStream out = new FileOutputStream(target); FileOutputStream out = new FileOutputStream(target);
PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, "UTF-8")); PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, "UTF-8"));
...@@ -48,21 +51,29 @@ public class PropertiesToUTF8 { ...@@ -48,21 +51,29 @@ public class PropertiesToUTF8 {
writer.close(); writer.close();
} }
private static void textUTF8ToProperties(String source, String target) throws Exception { static void textUTF8ToProperties(String source, String target) throws Exception {
if(!new File(source).exists()) {
return;
}
LineNumberReader reader = new LineNumberReader(new InputStreamReader(new FileInputStream(source), "UTF-8")); LineNumberReader reader = new LineNumberReader(new InputStreamReader(new FileInputStream(source), "UTF-8"));
Properties prop = new SortedProperties(); Properties prop = new SortedProperties();
StringBuffer buff = new StringBuffer(); StringBuffer buff = new StringBuffer();
String key = null; String key = null;
while(true) { while(true) {
String line = reader.readLine().trim(); String line = reader.readLine();
if(line == null) { if(line == null) {
break; break;
} }
line = line.trim();
if(line.length() == 0) {
continue;
}
if(line.startsWith("@")) { if(line.startsWith("@")) {
if(key != null) { if(key != null) {
prop.setProperty(key, buff.toString()); prop.setProperty(key, buff.toString());
buff.setLength(0); buff.setLength(0);
} }
key = line.substring(1);
} else { } else {
if(buff.length() > 0) { if(buff.length() > 0) {
buff.append(System.getProperty("line.separator")); buff.append(System.getProperty("line.separator"));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论