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
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-11-09 00:44:48 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-11-09 00:44:48 +0400
commitac6d91b9396c15d8bf1aa550adb4ca8c7125dd81 (patch)
tree88d1f046c6548331fdb705f91fcc63b8595f9f03 /SConstruct
parent0d1a49936627f2885b058f23920490bc6ed7c282 (diff)
Be ready for changes in bf-translations repository
Made it so if there's release/datafiles/locale/po folder, then all the .po files will be converted to .mo at blender compile time and installed to an appropriate location. Uses small own implementation msgfmt which is based on msgfmt.py from Python project, but also supports contexts. There's no functional changes for until we've switched to use source .po files instead of pre-compiled .mo. P.S. Well, there's one change which is msgfmt.cc being compiled even if it's not used, but would rather not clutter code with checks since pretty soon we'll use this program anyway.
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct21
1 files changed, 20 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index 4a08b691e07..29d4d65b167 100644
--- a/SConstruct
+++ b/SConstruct
@@ -944,6 +944,9 @@ if env['OURPLATFORM']!='darwin':
def check_path(path, member):
return (member in path.split(os.sep))
+ po_dir = os.path.join("release", "datafiles", "locale", "po")
+ need_compile_mo = os.path.exists(po_dir)
+
for intpath in internationalpaths:
for dp, dn, df in os.walk(intpath):
if '.svn' in dn:
@@ -952,7 +955,10 @@ if env['OURPLATFORM']!='darwin':
dn.remove('_svn')
# we only care about release/datafiles/fonts, release/datafiles/locales
- if check_path(dp, "fonts") or check_path(dp, "locale"):
+ if check_path(dp, "locale"):
+ if need_compile_mo and check_path(dp, "po"):
+ continue
+ elif check_path(dp, "fonts"):
pass
else:
continue
@@ -966,6 +972,19 @@ if env['OURPLATFORM']!='darwin':
env.Execute(Mkdir(dir))
scriptinstall.append(env.Install(dir=dir,source=source))
+ if need_compile_mo:
+ for f in os.listdir(po_dir):
+ if not f.endswith(".po"):
+ continue
+
+ locale_name = os.path.splitext(f)[0]
+
+ mo_file = os.path.join(B.root_build_dir, "locale", locale_name + ".mo")
+
+ dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
+ dir = os.path.join(dir, "datafiles", "locale", locale_name, "LC_MESSAGES")
+ scriptinstall.append(env.InstallAs(os.path.join(dir, "blender.mo"), mo_file))
+
#-- icons
if env['OURPLATFORM']=='linux':
iconlist = []