Localization/Translation FAQ
(2007-2011)
-
+
by Ran Rutenberg, Pavel Sanda, Michael Gerz
PART I - Interface translation
------------------------------
-This file is mainly intended for those who have no or little experience using
+This file is mainly intended for those who have no or little experience using
.po files, but want to contribute by translating the LyX interface (i.e. menu
and dialog items, console messages) into their native language.
2) HOW DO I EDIT PO FILES?
-PO files can be edited with any text editor available for your system (e.g.
-Vim, NotePad etc.). Yet another option is to use a specialized editor for .po
-files. You can e.g. use the editors "poEdit" or "jEdit", Linux users can
-additionally use e.g. "kbabel". Using these editors usually makes things easier
+PO files can be edited with any text editor available for your system (e.g.
+Vim, NotePad etc.). Yet another option is to use a specialized editor for .po
+files. You can e.g. use the editors "poEdit" or "jEdit", Linux users can
+additionally use e.g. "kbabel". Using these editors usually makes things easier
as they have many tools to assist the translator.
'&' stands for underlined characters (shortcut) in dialog boxes.
'|' stands for underlined characters in menus.
-These chars should be somehow used in your translations, however you'll have to
-invent your own working shortcuts for dialog and menu entries and resolve
-possible conflicts of the same shortcut chars in one menu...
+These chars should be somehow used in your translations, however you'll have to
+invent your own working shortcuts for dialog and menu entries and resolve
+possible conflicts of the same shortcut chars in one menu...
Note also that there are already used global shortcuts (such as p k x c m s a)
and you should avoid using these characters for first-level menu shortcuts.
-'$' and '%' are usually used as handlers for formatting or variables to be
-inserted into the strings. Character sequences like %1$s or %1$d MUST also
-appear in your translations! Please take them exactly as they are or you may
+'$' and '%' are usually used as handlers for formatting or variables to be
+inserted into the strings. Character sequences like %1$s or %1$d MUST also
+appear in your translations! Please take them exactly as they are or you may
experience crashes when running LyX.
[[Context]] is used to distinguish otherwise identical strings, which could
5) WHAT IS pocheck.pl AND HOW DO I USE IT?
-This is a small script located in the "po" directory of the source that helps
+This is a small script located in the "po" directory of the source that helps
you find common errors in your translation. In order to use this script you
need the script language Perl installed.
Run ./pocheck.pl -h to see all possible switches.
(from the git repository) and replace the existing .po with yours.
Afterwards, you should compile and optionally install LyX (check the
INSTALL file for your OS). Note that, as of LyX 2.1, it is not
-necessary anymore to install anything. In order to run LyX with your
-translation, change the current language in Preferences dialog or use
-the appropriate LANG variable:
+necessary anymore to install anything.
+
+In order to run LyX with your translation, change the current language
+in Preferences dialog or use the appropriate LANG variable:
On Linux: LANG=xx_CC lyx
On Windows, you need to change the lyx.bat file and write: set LANG=xx_CC
-xx stands for your language code. CC stands for your country code. So to get,
+xx stands for your language code. CC stands for your country code. So to get,
e.g., Czech, the code is "cs_CZ".
+Another possibility is to use the Preferences dialog to set LyX UI to
+use your language. Note that, as of LyX 2.2, a newly introduced
+language will not appear in the languages combox unless it corresponds
+to an entry of the lib/languages file that has a "HasGuiSupport true"
+property. See this file for more details.
+
The most comfortable way to see your updated translation while
editing, is running (in linux) "make xx.gmo" in the po directory to
compile updated xx.po translation and then run LyX.
- on Linux: execute the command: make update-po
- on Windows: either build the update-po target in MSVC
or run the command: msbuild po\update-po.vcxproj
- (depending on the directory you are in)
+ (depending on the directory you are in)
7) HOW TO CONTRIBUTE MY WORK?
#
# Language <lyxname>
# GuiName "<Gui Name>"
+# HasGuiSupport <true|false>
# BabelName <babelname>
# PolyglossiaName <polyglossianame>
# PolyglossiaOpts "<language-specific options>"
#
# * Omitted elements will be treated as empty (if string) or "false"
# (if boolean).
+# * When HasGuiSupport is true, the language is candidate to appear in
+# the list of possible GUI languages in the Preferences dialog. It
+# will actually appear there only if a corresponding .mo file can be
+# found among the translations. When several languages correspond to
+# the same translation -- like English, English (US) and English
+# (UK) -- try to select the entry that is most generic -- here
+# English.
# * The QuoteStyle arguments correspond to the following styles:
# - danish: >>text<< >text< (inward guillemets)
# - english: ``text'' `text' (66_99)
# to switch the language the way of the ArabTeX-package
Language arabic_arabtex
GuiName "Arabic (ArabTeX)"
+ HasGuiSupport true
BabelName arabtex
QuoteStyle french
Encoding cp1256
Language bahasa
GuiName "Indonesian"
+ HasGuiSupport true
BabelName bahasa
PolyglossiaName bahasai
QuoteStyle english
Language basque
GuiName "Basque"
+ HasGuiSupport true
BabelName basque
PolyglossiaName basque
QuoteStyle french
Language brazilian
GuiName "Portuguese (Brazil)"
+ HasGuiSupport true
BabelName brazil
PolyglossiaName brazil
QuoteStyle english
Language catalan
GuiName "Catalan"
+ HasGuiSupport true
BabelName catalan
PolyglossiaName catalan
PolyglossiaOpts "babelshorthands=true"
# uses CJK package
Language chinese-simplified
GuiName "Chinese (simplified)"
+ HasGuiSupport true
Encoding euc-cn
QuoteStyle english
LangCode zh_CN
# uses CJK package
Language chinese-traditional
GuiName "Chinese (traditional)"
+ HasGuiSupport true
QuoteStyle english
Encoding utf8-cjk
LangCode zh_TW
Language czech
GuiName "Czech"
+ HasGuiSupport true
BabelName czech
PolyglossiaName czech
QuoteStyle german
Language danish
GuiName "Danish"
+ HasGuiSupport true
BabelName danish
PolyglossiaName danish
QuoteStyle danish
Language dutch
GuiName "Dutch"
+ HasGuiSupport true
BabelName dutch
PolyglossiaName dutch
PolyglossiaOpts "babelshorthands=true"
Language english
GuiName "English"
+ HasGuiSupport true
BabelName english
PolyglossiaName english
QuoteStyle english
Language finnish
GuiName "Finnish"
+ HasGuiSupport true
BabelName finnish
PolyglossiaName finnish
QuoteStyle swedish
# We redefine \og and \fg (guillemets) for older french language definitions
Language french
GuiName "French"
+ HasGuiSupport true
BabelName french
PolyglossiaName french
QuoteStyle french
Language galician
GuiName "Galician"
+ HasGuiSupport true
BabelName galician
PolyglossiaName galician
QuoteStyle french
Language ngerman
GuiName "German"
+ HasGuiSupport true
BabelName ngerman
PolyglossiaName german
PolyglossiaOpts "babelshorthands=true"
Language greek
GuiName "Greek"
+ HasGuiSupport true
BabelName greek
PolyglossiaName greek
QuoteStyle french
Language hebrew
GuiName "Hebrew"
+ HasGuiSupport true
BabelName hebrew
PolyglossiaName hebrew
Encoding cp1255
# language. We therefore the name of its hunspell dictionary.
Language interlingua
GuiName "Interlingua"
+ HasGuiSupport true
BabelName interlingua
PolyglossiaName interlingua
Encoding iso8859-15
Language italian
GuiName "Italian"
+ HasGuiSupport true
BabelName italian
PolyglossiaName italian
QuoteStyle french
# InternalEncoding to true.
Language japanese
GuiName "Japanese"
+ HasGuiSupport true
BabelName japanese
Encoding jis-platex
LangCode ja_JP
Language magyar
GuiName "Hungarian"
+ HasGuiSupport true
BabelName magyar
PolyglossiaName magyar
QuoteStyle polish
Language norsk
GuiName "Norwegian (Bokmaal)"
+ HasGuiSupport true
BabelName norsk
PolyglossiaName norsk
QuoteStyle french
Language nynorsk
GuiName "Norwegian (Nynorsk)"
+ HasGuiSupport true
BabelName nynorsk
PolyglossiaName nynorsk
QuoteStyle french
Language polish
GuiName "Polish"
+ HasGuiSupport true
BabelName polish
PolyglossiaName polish
QuoteStyle polish
Language portuguese
GuiName "Portuguese"
+ HasGuiSupport true
BabelName portuges
PolyglossiaName portuges
QuoteStyle english
Language romanian
GuiName "Romanian"
+ HasGuiSupport true
BabelName romanian
PolyglossiaName romanian
QuoteStyle polish
Language russian
GuiName "Russian"
+ HasGuiSupport true
BabelName russian
PolyglossiaName russian
QuoteStyle french
Language serbian
GuiName "Serbian"
+ HasGuiSupport true
BabelName serbianc
PolyglossiaName serbian
QuoteStyle german
Language slovak
GuiName "Slovak"
+ HasGuiSupport true
BabelName slovak
PolyglossiaName slovak
QuoteStyle german
Language spanish
GuiName "Spanish"
+ HasGuiSupport true
BabelName spanish
PolyglossiaName spanish
QuoteStyle french
Language swedish
GuiName "Swedish"
+ HasGuiSupport true
BabelName swedish
PolyglossiaName swedish
QuoteStyle swedish
Language turkish
GuiName "Turkish"
+ HasGuiSupport true
BabelName turkish
PolyglossiaName turkish
QuoteStyle french
Language ukrainian
GuiName "Ukrainian"
+ HasGuiSupport true
BabelName ukrainian
PolyglossiaName ukrainian
QuoteStyle french
startCommandED->setValidator(new NoNewLineValidator(startCommandED));
endCommandED->setValidator(new NoNewLineValidator(endCommandED));
- uiLanguageCO->clear();
-
- QAbstractItemModel * language_model = guiApp->languageModel();
- // FIXME: it would be nice if sorting was enabled/disabled via a checkbox.
- language_model->sort(0);
defaultDecimalPointLE->setInputMask("X; ");
defaultDecimalPointLE->setMaxLength(1);
defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::CM]), Length::CM);
defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::IN]), Length::IN);
- set<string> added;
+ QAbstractItemModel * language_model = guiApp->languageModel();
+ language_model->sort(0);
uiLanguageCO->blockSignals(true);
+ uiLanguageCO->clear();
uiLanguageCO->addItem(qt_("Default"), toqstr("auto"));
for (int i = 0; i != language_model->rowCount(); ++i) {
QModelIndex index = language_model->index(i, 0);
if (name != form->rc().gui_language
&& name != lyxrc.gui_language
&& (!Messages::available(lang->code())
- || added.find(lang->code()) != added.end()))
- continue;
- added.insert(lang->code());
+ || !lang->hasGuiSupport()))
+ continue;
uiLanguageCO->addItem(index.data(Qt::DisplayRole).toString(),
- index.data(Qt::UserRole).toString());
+ index.data(Qt::UserRole).toString());
}
uiLanguageCO->blockSignals(false);
}