Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/po
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-09-28 12:13:06 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-09-28 12:13:06 +0400
commitc941403bc30528e4a90d180c7351c5bf1882fff6 (patch)
treea8a89f3ef341971b91875134682b43510c5dc683 /po
parent4158cee688f4a63f8f3a4ff5e20fa3c6b3f95719 (diff)
i18n: wrote small instruction for translators
- Added po/README.txt file with translation instructions - If update_po and update_mo scripts now allows to provide list of languages which should be handled only, i.e. ./update_mo.py ru - Removed obsolete file from POTFILES.in
Diffstat (limited to 'po')
-rw-r--r--po/POTFILES.in1
-rw-r--r--po/README.txt61
-rwxr-xr-xpo/update_mo.py41
-rwxr-xr-xpo/update_po.py42
4 files changed, 115 insertions, 30 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4c791dd9369..30c1d91b572 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,5 @@
release/scripts/modules/rna_prop_ui.py
-release/scripts/startup/bl_operators/animsys_update.py
release/scripts/startup/bl_operators/object.py
release/scripts/startup/bl_operators/object_align.py
release/scripts/startup/bl_operators/object_quick_effects.py
diff --git a/po/README.txt b/po/README.txt
new file mode 100644
index 00000000000..ba7b51bd5c5
--- /dev/null
+++ b/po/README.txt
@@ -0,0 +1,61 @@
+Blender translation HOWTO
+=========================
+
+I'll try briefly explain how translation works and how to update translation files.
+
+1. How it works
+---------------
+
+This folder contains source files for translation system. This source files have
+got .po extension and they've got pretty simple syntax:
+
+msgid "some message id"
+msgstr "translation for this message"
+
+This means when string "some message id" is used as operator name, tooltip, menu
+and so it'll be displayed on the screen as "translation for this message".
+Pretty simple.
+
+This source files are pre-compiled into ../relese/dbin/.blender/locale/<language>/LC_MESSAGES/blender.mo,
+so they aren't getting compiled every time Blender is compiling to same some time and prevent
+failure on systems which doesn't have needed tools for compiling .po files.
+
+2. How to update translations
+-----------------------------
+
+It's also pretty simple. If you can find string you want to translate in <language>.po
+file as msgid, just write correct msgstr string for it. If msgid is marked as fuzzy,
+i.e.
+
+#, fuzzy
+msgid "some message id"
+msgstr "translation for this message"
+
+it means translation used to exist for this message, but message was changed, so translation
+also have to be updated (it's easier to make new translation based on previos translation).
+When translation was updated, remove line with '#, fuzzy' and it'll work.
+
+If there's no message in .po file you want to translate, probably .po file should be updated.
+Use the following steps for this:
+- With newly compiled blender run `blender --background --python update_msg.py` to update
+ messages.txt file (this file contains strings collected automatically from RNA system and
+ python UI scripts)
+- Run update_pot.py script which will update blender.pot file. This file contains all
+ strings which should be transated.
+- Run update_po.py script to merge all .po files with blender.pot (so all .po files
+ will contain all msgid-s declared in blender.pot) or update_po.py <language> to
+ update only needed .po file(s) to save time when you're busy with translation.
+ But before ocmmit all .po files better be updated.
+
+When you've finished with translation, you should re-compile .po file into .mo file.
+It's also pretty simple: just run update_mo.py script to recompile all languages or
+just update_mo.py <language> to re-compile only needed language(s).
+
+NOTE: msgfmt, msgmerge and xgettext tools should be available in your PATH.
+
+This steps to update template, translation files and compile them can be made in "batch" mode
+using GNUMakefile:
+
+make -f GNUMakefile translations
+
+NOTE: Blender has to be compiled using GNUMakefile first.
diff --git a/po/update_mo.py b/po/update_mo.py
index 51591af8a0e..fc70891de8f 100755
--- a/po/update_mo.py
+++ b/po/update_mo.py
@@ -25,6 +25,7 @@
import subprocess
import os
+import sys
CURRENT_DIR = os.path.dirname(__file__)
SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.join(CURRENT_DIR, "..")))
@@ -33,21 +34,33 @@ LOCALE_DIR = os.path.join(SOURCE_DIR, "release", "bin", ".blender", "locale")
DOMAIN = "blender"
+def process_po(po):
+ lang = os.path.basename(po)[:-3]
+
+ # show stats
+ cmd = ("msgfmt",
+ "--statistics",
+ os.path.join(CURRENT_DIR, "%s.po" % lang),
+ "-o",
+ os.path.join(LOCALE_DIR, lang, "LC_MESSAGES", "%s.mo" % DOMAIN),
+ )
+
+ print(" ".join(cmd))
+ process = subprocess.Popen(cmd)
+ process.wait()
+
+
def main():
- for po in os.listdir(CURRENT_DIR):
- if po.endswith(".po"):
- lang = po[:-3]
- # show stats
- cmd = ("msgfmt",
- "--statistics",
- os.path.join(CURRENT_DIR, "%s.po" % lang),
- "-o",
- os.path.join(LOCALE_DIR, lang, "LC_MESSAGES", "%s.mo" % DOMAIN),
- )
-
- print(" ".join(cmd))
- process = subprocess.Popen(cmd)
- process.wait()
+ if len(sys.argv) > 1:
+ for lang in sys.argv[1:]:
+ po = os.path.join(CURRENT_DIR, lang + '.po')
+
+ if os.path.exists(po):
+ process_po(po)
+ else:
+ for po in os.listdir(CURRENT_DIR):
+ if po.endswith(".po"):
+ process_po(po)
if __name__ == "__main__":
print("\n\n *** Running %r *** \n" % __file__)
diff --git a/po/update_po.py b/po/update_po.py
index bbdf7224908..45738363966 100755
--- a/po/update_po.py
+++ b/po/update_po.py
@@ -25,27 +25,39 @@
import subprocess
import os
+import sys
CURRENT_DIR = os.path.dirname(__file__)
DOMAIN = "blender"
+def process_po(po):
+ lang = os.path.basename(po)[:-3]
+
+ # update po file
+ cmd = ("msgmerge",
+ "--update",
+ "--lang=%s" % lang,
+ os.path.join(CURRENT_DIR, "%s.po" % lang),
+ os.path.join(CURRENT_DIR, "%s.pot" % DOMAIN),
+ )
+
+ print(" ".join(cmd))
+ process = subprocess.Popen(cmd)
+ process.wait()
+
+
def main():
- for po in os.listdir(CURRENT_DIR):
- if po.endswith(".po"):
- lang = po[:-3]
-
- # update po file
- cmd = ("msgmerge",
- "--update",
- "--lang=%s" % lang,
- os.path.join(CURRENT_DIR, "%s.po" % lang),
- os.path.join(CURRENT_DIR, "%s.pot" % DOMAIN),
- )
-
- print(" ".join(cmd))
- process = subprocess.Popen(cmd)
- process.wait()
+ if len(sys.argv) > 1:
+ for lang in sys.argv[1:]:
+ po = os.path.join(CURRENT_DIR, lang + '.po')
+
+ if os.path.exists(po):
+ process_po(po)
+ else:
+ for po in os.listdir(CURRENT_DIR):
+ if po.endswith(".po"):
+ process_po(po)
if __name__ == "__main__":