Copy "en.lproj" in cocoa app so that english is actually chosen when it's at the top of the list in the Cocoa language settings.

This commit is contained in:
Virgil Dupras 2012-08-08 10:26:33 -04:00
parent 54988650d7
commit 4de40af1b0
1 changed files with 11 additions and 9 deletions

View File

@ -13,13 +13,12 @@ from optparse import OptionParser
import shutil import shutil
import json import json
import importlib import importlib
import glob
from setuptools import setup, Extension from setuptools import setup, Extension
from hscommon import sphinxgen from hscommon import sphinxgen
from hscommon.build import (add_to_pythonpath, print_and_do, copy_packages, filereplace, from hscommon.build import (add_to_pythonpath, print_and_do, copy_packages, filereplace,
get_module_version, move_all, copy_sysconfig_files_for_embed, copy_all, move, get_module_version, move_all, copy_sysconfig_files_for_embed, copy_all, move, copy,
OSXAppStructure, build_cocoalib_xibless, fix_qt_resource_file) OSXAppStructure, build_cocoalib_xibless, fix_qt_resource_file)
from hscommon import loc from hscommon import loc
from hscommon.plat import ISOSX from hscommon.plat import ISOSX
@ -165,17 +164,20 @@ def build_base_localizations():
def build_cocoa_localizations(edition): def build_cocoa_localizations(edition):
print("Creating lproj folders based on .po files") print("Creating lproj folders based on .po files")
app = cocoa_app(edition) app = cocoa_app(edition)
en_stringsfile = op.join('cocoa', 'base', 'en.lproj', 'Localizable.strings')
en_cocoastringsfile = op.join('cocoalib', 'en.lproj', 'cocoalib.strings')
for lang in loc.get_langs('locale'): for lang in loc.get_langs('locale'):
if lang == 'en':
continue
pofile = op.join('locale', lang, 'LC_MESSAGES', 'ui.po') pofile = op.join('locale', lang, 'LC_MESSAGES', 'ui.po')
stringsfile = op.join('cocoa', 'base', 'en.lproj', 'Localizable.strings')
dest_lproj = op.join(app.resources, lang + '.lproj') dest_lproj = op.join(app.resources, lang + '.lproj')
if not op.exists(dest_lproj): ensure_folder(dest_lproj)
os.makedirs(dest_lproj) loc.po2strings(pofile, en_stringsfile, op.join(dest_lproj, 'Localizable.strings'))
loc.po2strings(pofile, stringsfile, op.join(dest_lproj, 'Localizable.strings'))
pofile = op.join('cocoalib', 'locale', lang, 'LC_MESSAGES', 'cocoalib.po') pofile = op.join('cocoalib', 'locale', lang, 'LC_MESSAGES', 'cocoalib.po')
loc.po2strings(pofile, op.join('cocoalib', 'en.lproj', 'cocoalib.strings'), op.join(dest_lproj, 'cocoalib.strings')) loc.po2strings(pofile, en_cocoastringsfile, op.join(dest_lproj, 'cocoalib.strings'))
# We also have to copy the "en.lproj" strings
en_lproj = op.join(app.resources, 'en.lproj')
ensure_folder(en_lproj)
copy(en_stringsfile, en_lproj)
copy(en_cocoastringsfile, en_lproj)
def build_qt_localizations(): def build_qt_localizations():
loc.compile_all_po(op.join('qtlib', 'locale')) loc.compile_all_po(op.join('qtlib', 'locale'))