Localization improvements and removing some unused code

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@143 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2012-03-19 21:01:15 +00:00
parent de74e5ff6b
commit e3a808f820
39 changed files with 435 additions and 1442 deletions

View file

@ -37,6 +37,7 @@ import org.w3c.dom.Element;
import writer2latex.api.IndexPageEntry;
import writer2latex.api.OutputFile;
import writer2latex.base.BatchConverterBase;
import writer2latex.xhtml.l10n.L10n;
/**
* Implementation of <code>writer2latex.api.BatchConverter</code> for

View file

@ -60,6 +60,7 @@ import writer2latex.office.StyleWithProperties;
import writer2latex.office.XMLString;
import writer2latex.util.ExportNameCollection;
import writer2latex.util.Misc;
import writer2latex.xhtml.l10n.L10n;
/**
* <p>This class converts an OpenDocument file to an XHTML(+MathML) or EPUB document.</p>

View file

@ -1,325 +0,0 @@
/************************************************************************
*
* L10n.java
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2011 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2011-07-25)
*
*/
package writer2latex.xhtml;
import java.util.Locale;
// This class handles localized strings (used for navigation)
public class L10n {
public final static int UP = 0;
public final static int FIRST = 1;
public final static int PREVIOUS = 2;
public final static int NEXT = 3;
public final static int LAST = 4;
public final static int CONTENTS = 5;
public final static int INDEX = 6;
public final static int HOME = 7;
public final static int DIRECTORY = 8;
public final static int DOCUMENT = 9;
private Locale locale = null;
private String sLocale="en-US";
public void setLocale(String sLanguage, String sCountry) {
if (sLanguage!=null) {
if (sCountry!=null) {
locale = new Locale(sLanguage,sCountry);
}
else {
locale = new Locale(sLanguage);
}
}
else {
locale = Locale.getDefault();
}
if (locale.getCountry().length()>0) {
sLocale = locale.getLanguage()+"-"+locale.getCountry();
}
else {
sLocale = locale.getLanguage();
}
}
public Locale getLocale() {
return locale;
}
public String get(int nString) {
if (sLocale.startsWith("de")) { // German
switch (nString) {
case UP: return "Nach oben";
case FIRST : return "Anfang";
case PREVIOUS : return "Vorheriges";
case NEXT : return "N\u00e4chstes";
case LAST : return "Ende";
case CONTENTS : return "Inhalte";
case INDEX : return "Index";
case HOME : return "Home";
case DIRECTORY: return "Verzeichnis";
case DOCUMENT: return "Dokument";
}
}
if (sLocale.startsWith("fr")) { // French
switch (nString) {
case UP: return "Haut";
case FIRST : return "D\u00e9but";
case PREVIOUS : return "Pr\u00e9c\u00e9dent";
case NEXT : return "Suivant";
case LAST : return "Dernier";
case CONTENTS : return "Contenus";
case INDEX : return "Index";
case HOME : return "Documents Personnels";
case DIRECTORY: return "R\u00e9pertoire";
case DOCUMENT: return "Document";
}
}
if (sLocale.startsWith("es")) { // Spanish
switch (nString) {
case UP: return "Arriba";
case FIRST : return "Primero";
case PREVIOUS : return "Previo";
case NEXT : return "Siguiente";
case LAST : return "\u00daltimo";
case CONTENTS : return "Contenido";
case INDEX : return "\u00cdndice";
case HOME : return "Inicio";
case DIRECTORY: return "Directorio";
case DOCUMENT: return "Documento";
}
}
if (sLocale.startsWith("it")) { // Italian
switch (nString) {
case UP: return "Su";
case FIRST : return "Inizio";
case PREVIOUS : return "Precedente";
case NEXT : return "Successivo";
case LAST : return "Fine";
case CONTENTS : return "Sommario";
case INDEX : return "Indice";
case HOME : return "Home";
case DIRECTORY: return "Cartella";
case DOCUMENT: return "Documento";
}
}
if (sLocale.startsWith("pt")) { // (Brazilian) Portuguese
switch (nString) {
case UP: return "Acima";
case FIRST : return "Primeiro";
case PREVIOUS : return "Anterior";
case NEXT : return "Pr\u00f3ximo";
case LAST : return "\u00daltimo";
case CONTENTS : return "Conte\u00fado";
case INDEX : return "\u00cdndice";
case HOME : return "Home";
case DIRECTORY: return "Diret\u00f3rio";
case DOCUMENT: return "Documento";
}
}
if (sLocale.startsWith("cs")) { // Czech
switch (nString) {
case UP: return "Nahoru";
case FIRST : return "Prvn\u00ed";
case PREVIOUS : return "P\u0159edchoz\u00ed";
case NEXT : return "Dal\u0161\u00ed";
case LAST : return "Posledn\u00ed";
case CONTENTS : return "Obsah";
case INDEX : return "Rejst\u0159\u00edk";
case HOME : return "Dom\u016f";
case DIRECTORY: return "Adres\u00e1\u0159 (slo\u017eka)";
case DOCUMENT: return "Dokument";
}
}
if (sLocale.startsWith("nl")) { // Dutch
switch (nString) {
case UP: return "Omhoog";
case FIRST : return "Eerste";
case PREVIOUS : return "Vorige";
case NEXT : return "Volgende";
case LAST : return "Laatste";
case CONTENTS : return "Inhoud";
case INDEX : return "Index";
case HOME : return "Hoofdpagina";
case DIRECTORY: return "Directory";
case DOCUMENT: return "Document";
}
}
if (sLocale.startsWith("da")) { // Danish
switch (nString) {
case UP: return "Op";
case FIRST : return "F\u00F8rste";
case PREVIOUS : return "Forrige";
case NEXT : return "N\u00E6ste";
case LAST : return "Sidste";
case CONTENTS : return "Indhold";
case INDEX : return "Stikord";
case HOME : return "Hjem";
case DIRECTORY: return "Mappe";
case DOCUMENT: return "Dokument";
}
}
if (sLocale.startsWith("nn")) { // Nynorsk
switch (nString) {
case UP: return "Opp";
case FIRST : return "F\u00f8rste";
case PREVIOUS : return "Forrige";
case NEXT : return "Neste";
case LAST : return "Siste";
case CONTENTS : return "Innhald";
case INDEX : return "Register";
case HOME : return "Heim";
case DIRECTORY: return "Mappe";
case DOCUMENT: return "Dokument";
}
}
if (sLocale.startsWith("pl")) { // Polish
switch (nString) {
case UP: return "W g\u00f3r\u0119";
case FIRST : return "Pierwsza";
case PREVIOUS : return "Poprzednia";
case NEXT : return "Nast\u0119pna";
case LAST : return "Ostatnia";
case CONTENTS : return "Spis tre\u015bci";
case INDEX : return "Indeks";
case HOME : return "Pocz\u0105tek";
case DIRECTORY: return "Katalog";
case DOCUMENT: return "Dokument";
}
}
if (sLocale.startsWith("fi")) { // Finnish
switch (nString) {
case UP: return "Yl\u00f6s";
case FIRST : return "Ensimm\u00e4inen";
case PREVIOUS : return "Edellinen";
case NEXT : return "Seuraava";
case LAST : return "Viimeinen";
case CONTENTS : return "Sis\u00e4lt\u00f6";
case INDEX : return "Indeksi";
case HOME : return "Koti";
case DIRECTORY: return "Hakemisto";
case DOCUMENT: return "Dokumentti";
}
}
if (sLocale.startsWith("ca")) { // Catalan
switch (nString) {
case UP: return "Amunt";
case FIRST : return "Comen\u00e7ament";
case PREVIOUS : return "Precedent";
case NEXT : return "Seg\u00fcent";
case LAST: return "Darrer";
case CONTENTS : return "Contingut";
case INDEX : return "\u00cdndex";
case HOME : return "Arrel";
case DIRECTORY: return "Directori";
case DOCUMENT: return "Document";
}
}
if (sLocale.startsWith("ru")) { // Russian
switch (nString) {
case UP: return "\u0412\u0432\u0435\u0440\u0445";
case FIRST : return "\u041f\u0435\u0440\u0432\u0430\u044f";
case PREVIOUS : return "\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f";
case NEXT : return "\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f";
case LAST : return "\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f";
case CONTENTS : return "\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435";
case INDEX : return "\u0421\u043f\u0438\u0441\u043e\u043a";
case HOME : return "\u0414\u043e\u043c\u043e\u0439";
case DIRECTORY: return "\u0414\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f";
case DOCUMENT: return "\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442";
}
}
if (sLocale.startsWith("uk")) { // Ukrainian
switch (nString) {
case UP: return "\u041d\u0430\u0433\u043e\u0440\u0443";
case FIRST : return "\u041f\u0435\u0440\u0448\u0430";
case PREVIOUS : return "\u041f\u043e\u043f\u0435\u0440\u0435\u0434\u043d\u044f";
case NEXT : return "\u041d\u0430\u0441\u0442\u0443\u043f\u043d\u0430";
case LAST : return "\u041e\u0441\u0442\u0430\u043d\u043d\u044f";
case CONTENTS : return "\u0417\u043c\u0456\u0441\u0442";
case INDEX : return "\u0421\u043f\u0438\u0441\u043e\u043a";
case HOME : return "\u0414\u043e\u0434\u043e\u043c\u0443";
case DIRECTORY: return "\u0422\u0435\u043a\u0430";
case DOCUMENT: return "\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442";
}
}
if (sLocale.startsWith("tr")) { // Turkish
switch (nString) {
case UP: return "Yukar\u0131";
case FIRST : return "\u0130lk";
case PREVIOUS : return "\u00d6nceki";
case NEXT : return "Sonraki";
case LAST : return "Son";
case CONTENTS : return "\u0130\u00e7indekiler";
case INDEX : return "\u0130ndeks";
case HOME : return "Ev";
case DIRECTORY: return "Klas\u00f6r";
case DOCUMENT: return "D\u00f6k\u00fcman";
}
}
if (sLocale.startsWith("hr")) { // Croatian
switch (nString) {
case UP: return "Up";
case FIRST : return "Prvi";
case PREVIOUS : return "Prethodan";
case NEXT : return "slijede\u0107i";
case LAST : return "Zadnji";
case CONTENTS : return "Sadr\u017Eaj";
case INDEX : return "Indeks";
case DIRECTORY: return "Directory";
case DOCUMENT: return "Document";
}
}
if (sLocale.startsWith("fa")) { // Farsi
switch (nString) {
case UP: return "\u0628\u0627\u0644\u0627";
case FIRST : return "\u0627\u0648\u0644";
case PREVIOUS : return "\u0642\u0628\u0644\u06cc";
case NEXT : return "\u0628\u0639\u062f\u06cc";
case LAST : return "\u0627\u062e\u0631\u06cc\u0646";
//case CONTENTS : return "??";
case INDEX : return "\u0641\u0647\u0631\u0633\u062a";
case HOME : return "\u062e\u0627\u0646\u0647";
case DIRECTORY: return "\u067e\u0648\u0634\u0647";
case DOCUMENT: return "\u0645\u0633\u062a\u0646\u062f";
}
}
// English - default
switch (nString) {
case UP: return "Up";
case FIRST : return "First";
case PREVIOUS : return "Previous";
case NEXT : return "Next";
case LAST: return "Last";
case CONTENTS : return "Contents";
case INDEX : return "Index";
case HOME : return "Home";
case DIRECTORY: return "Directory";
case DOCUMENT: return "Document";
}
return "???";
}
}

View file

@ -40,6 +40,7 @@ import org.w3c.dom.NodeList;
import org.w3c.dom.Element;
import writer2latex.util.Misc;
import writer2latex.xhtml.l10n.L10n;
import writer2latex.office.FontDeclaration;
import writer2latex.office.OfficeStyle;
import writer2latex.office.XMLString;

View file

@ -0,0 +1,88 @@
/************************************************************************
*
* L10n.java
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2012 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.4 (2012-03-16)
*
*/
package writer2latex.xhtml.l10n;
import java.util.Locale;
import java.util.ResourceBundle;
/* This class handles localized strings (used for navigation links in the exported document)
* Note that the US-English strings need duplicated due to ResourceBundles' search order.
* Default strings are needed for the special case that neither strings for the document language,
* nor for the system default language are available.
* US-English strings are needed if the document language is English and the system locale is not.
*/
public class L10n {
public final static int UP = 0;
public final static int FIRST = 1;
public final static int PREVIOUS = 2;
public final static int NEXT = 3;
public final static int LAST = 4;
public final static int CONTENTS = 5;
public final static int INDEX = 6;
public final static int HOME = 7;
public final static int DIRECTORY = 8;
public final static int DOCUMENT = 9;
private ResourceBundle resourceBundle = ResourceBundle.getBundle("writer2latex.xhtml.l10n.XhtmlStrings",Locale.getDefault());
private Locale locale = null;
public void setLocale(String sLanguage, String sCountry) {
if (sLanguage!=null) {
if (sCountry!=null) {
locale = new Locale(sLanguage,sCountry);
}
else {
locale = new Locale(sLanguage);
}
}
else {
locale = Locale.getDefault();
}
resourceBundle = ResourceBundle.getBundle("writer2latex.xhtml.l10n.XhtmlStrings",locale);
}
public Locale getLocale() {
return locale;
}
public String get(int nString) {
switch (nString) {
case UP: return resourceBundle.getString("up");
case FIRST : return resourceBundle.getString("first");
case PREVIOUS : return resourceBundle.getString("previous");
case NEXT : return resourceBundle.getString("next");
case LAST : return resourceBundle.getString("last");
case CONTENTS : return resourceBundle.getString("contents");
case INDEX : return resourceBundle.getString("index");
case HOME : return resourceBundle.getString("home");
case DIRECTORY: return resourceBundle.getString("directory");
case DOCUMENT: return resourceBundle.getString("document");
default: return "???";
}
}
}

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Up
first=First
previous=Previous
next=Next
last=Last
contents=Contents
index=Index
home=Home
directory=Directory
document=Document

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Amunt
first=Comen\u00e7ament
previous=Precedent
next=Seg\u00fcent
last=Darrer
contents=Contingut
index=\u00cdndex
home=Arrel
directory=Directori
document=Document

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Nahoru
first=Prvn\u00ed
previous=P\u0159edchoz\u00ed
next=Dal\u0161\u00ed
last=Posledn\u00ed
contents=Obsah
index=Rejst\u0159\u00edk
home=Dom\u016f
directory=Adres\u00e1\u0159 (slo\u017eka)
document=Dokument

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Op
first=F\u00F8rste
previous=Forrige
next=N\u00E6ste
last=Sidste
contents=Indhold
index=Stikord
home=Hjem
directory=Mappe
document=Dokument

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Nach oben
first=Anfang
previous=Vorheriges
next=N\u00e4chstes
last=Ende
contents=Inhalte
index=Index
home=Home
directory=Verzeichnis
document=Dokument

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Up
first=First
previous=Previous
next=Next
last=Last
contents=Contents
index=Index
home=Home
directory=Directory
document=Document

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Arriba
first=Primero
previous=Previo
next=Siguiente
last=\u00daltimo
contents=Contenido
index=\u00cdndice
home=Inicio
directory=Directorio
document=Documento

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=\u0628\u0627\u0644\u0627
first=\u0627\u0648\u0644
previous=\u0642\u0628\u0644\u06cc
next=\u0628\u0639\u062f\u06cc
last=\u0627\u062e\u0631\u06cc\u0646
contents=Contents
index=\u0641\u0647\u0631\u0633\u062a
home=\u062e\u0627\u0646\u0647
directory=\u067e\u0648\u0634\u0647
document=\u0645\u0633\u062a\u0646\u062f

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Yl\u00f6s
first=Ensimm\u00e4inen
previous=Edellinen
next=Seuraava
last=Viimeinen
contents=Sis\u00e4lt\u00f6
index=Indeksi
home=Koti
directory=Hakemisto
document=Dokumentti

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Haut
first=D\u00e9but
previous=Pr\u00e9c\u00e9dent
next=Suivant
last=Dernier
contents=Contenus
index=Index
home=Documents Personnels
directory=R\u00e9pertoire
document=Document

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Up
first=Prvi
previous=Prethodan
next=slijede\u0107i
last=Zadnji
contents=Sadr\u017Eaj
index=Indeks
home=Home
directory=Directory
document=Document

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Su
first=Inizio
previous=Precedente
next=Successivo
last=Fine
contents=Sommario
index=Indice
home=Home
directory=Cartella
document=Documento

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Omhoog
first=Eerste
previous=Vorige
next=Volgende
last=Laatste
contents=Inhoud
index=Index
home=Hoofdpagina
directory=Directory
document=Document

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Opp
first=F\u00f8rste
previous=Forrige
next=Neste
last=Siste
contents=Innhald
index=Register
home=Heim
directory=Mappe
document=Dokument

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=W g\u00f3r\u0119
first=Pierwsza
previous=Poprzednia
next=Nast\u0119pna
last=Ostatnia
contents=Spis tre\u015bci
index=Indeks
home=Pocz\u0105tek
directory=Katalog
document=Dokument

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Acima
first=Primeiro
previous=Anterior
next=Pr\u00f3ximo
last=\u00daltimo
contents=Conte\u00fado
index=\u00cdndice
home=Home
directory=Diret\u00f3rio
document=Documento

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=\u0412\u0432\u0435\u0440\u0445
first=\u041f\u0435\u0440\u0432\u0430\u044f
previous=\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f
next=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f
last=\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f
contents=\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435
index=\u0421\u043f\u0438\u0441\u043e\u043a
home=\u0414\u043e\u043c\u043e\u0439
directory=\u0414\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f
document=\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=Yukar\u0131
first=\u0130lk
previous=\u00d6nceki
next=Sonraki
last=Son
contents=\u0130\u00e7indekiler
index=\u0130ndeks
home=Ev
directory=Klas\u00f6r
document=D\u00f6k\u00fcman

View file

@ -0,0 +1,11 @@
# XHTML specific strings for Writer2LaTeX
up=\u041d\u0430\u0433\u043e\u0440\u0443
first=\u041f\u0435\u0440\u0448\u0430
previous=\u041f\u043e\u043f\u0435\u0440\u0435\u0434\u043d\u044f
next=\u041d\u0430\u0441\u0442\u0443\u043f\u043d\u0430
last=\u041e\u0441\u0442\u0430\u043d\u043d\u044f
contents=\u0417\u043c\u0456\u0441\u0442
index=\u0421\u043f\u0438\u0441\u043e\u043a
home=\u0414\u043e\u0434\u043e\u043c\u0443
directory=\u0422\u0435\u043a\u0430
document=\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442