snej / Murky
A GUI client app for the Mercurial version-control system. Written for Mac OS X, in Objective-C.
| commit 138: | bf51f845a755 |
| parent 137: | 53c115ea3428 |
| branch: | default |
Changed (Δ9.8 KB):
.hgignore (1 lines added, 0 lines removed)
English.lproj/InfoPlist.strings (binary file changed)
English.lproj/Localizable.strings (binary file changed)
French.lproj/InfoPlist.strings (binary file changed)
German.lproj/InfoPlist.strings (binary file changed)
German.lproj/Localizable.strings (binary file changed)
Localize.py (28 lines added, 15 lines removed)
Murky.xcodeproj/project.pbxproj (2 lines added, 2 lines removed)
| … | … | @@ -5,6 +5,7 @@ build |
5 |
5 |
(*) |
6 |
6 |
*.pbxuser |
7 |
7 |
*.perspectivev3 |
8 |
*.pyc |
|
8 |
9 |
*.mode1v3 |
9 |
10 |
*.mode2v3 |
10 |
11 |
*.mpkg |
Up to file-list English.lproj/InfoPlist.strings:
Up to file-list English.lproj/Localizable.strings:
Up to file-list French.lproj/InfoPlist.strings:
Up to file-list German.lproj/InfoPlist.strings:
Up to file-list German.lproj/Localizable.strings:
| … | … | @@ -13,18 +13,15 @@ Written by David Keegan for Murky |
13 |
13 |
http://bitbucket.org/snej/murky |
14 |
14 |
|
15 |
15 |
Usage: |
16 |
Localize.py [options] |
|
17 |
||
18 |
Options: |
|
19 |
-h, --help show this help message and exit |
|
20 |
-f LANG, --from=LANG the language to localize from |
|
21 |
-t LANGS, --to=LANGS an array of languages to localize to, separated by '|' |
|
22 |
-n NIBS, --nibs=NIBS an array of nibs to localize, separated by '|', .xib |
|
23 |
can be left off |
|
24 |
-u, --utf8 if this flag is present the .strings files will be re- |
|
25 |
encoded as utf-8 |
|
26 |
-i, --ignore if this flag is present the md5 checksums will be |
|
27 |
ignored |
|
16 |
Localize.py -help |
|
17 |
||
18 |
Localize nibs: |
|
19 |
Localize.py --from English --to "French|German" --nibs "MainMenu|Projects|Repo" |
|
20 |
||
21 |
Generate Strings: |
|
22 |
Localize.py --to English --genstrings "./**/*.[hm]" |
|
23 |
||
24 |
Use the '--utf8' flag to convert the strings files from utf-16 to utf-8. |
|
28 |
25 |
|
29 |
26 |
The MIT License |
30 |
27 |
|
| … | … | @@ -136,6 +133,16 @@ def writeNib(fromFile, toFile, utf8=Fals |
136 |
133 |
|
137 |
134 |
print ' ', toFile, 'updated' |
138 |
135 |
|
136 |
def genStrings(toLangs, globString, utf8=False): |
|
137 |
for eachToLang in toLangs: |
|
138 |
toLangLproj = eachToLang.strip()+'.lproj' |
|
139 |
runCommand('genstrings', '-o %s %s' % (toLangLproj, globString)) |
|
140 |
localizableStrings = os.path.join(toLangLproj, 'Localizable.strings') |
|
141 |
if utf8: |
|
142 |
fileToUtf8(localizableStrings) |
|
143 |
||
144 |
print ' ', localizableStrings, 'updated' |
|
145 |
||
139 |
146 |
def localizeNibs(fromLang, toLangs, nibs, utf8=False, ignore=False): |
140 |
147 |
'''Localize nibs from one language to others''' |
141 |
148 |
|
| … | … | @@ -148,7 +155,7 @@ def localizeNibs(fromLang, toLangs, nibs |
148 |
155 |
else: |
149 |
156 |
jsonData = {} |
150 |
157 |
|
151 |
fromLangLproj = fromLang |
|
158 |
fromLangLproj = fromLang.strip()+'.lproj' |
|
152 |
159 |
for eachToLang in toLangs: |
153 |
160 |
toLangLproj = eachToLang.strip()+'.lproj' |
154 |
161 |
for eachNib in nibs: |
| … | … | @@ -181,7 +188,13 @@ if __name__ == '__main__': |
181 |
188 |
opts.add_option('--nibs', '-n', dest='nibs', help="an array of nibs to localize, separated by '|', .xib can be left off", metavar='NIBS') |
182 |
189 |
opts.add_option('--utf8', '-u', dest='utf8', help='if this flag is present the .strings files will be re-encoded as utf-8', action="store_true", default=False) |
183 |
190 |
opts.add_option('--ignore', '-i', dest='ignore', help='if this flag is present the md5 checksums will be ignored', action="store_true", default=False) |
191 |
opts.add_option('--genstrings', '-g', dest='genstrings', help='if this argument is present the genstrings command line will be called', metavar='GLOB', default=None) |
|
184 |
192 |
options, arguments = opts.parse_args() |
185 |
193 |
|
186 |
localizeNibs(options.fromLang, options.toLangs.split('|'), options.nibs.split('|'), options.utf8, options.ignore) |
|
187 |
print 'Nibs updated in %.2f seconds' % (time.time()-startTime) |
|
194 |
if options.genstrings != None: |
|
195 |
genStrings(options.toLangs.split('|'), options.genstrings, options.utf8) |
|
196 |
print 'Strings updated in %.2f seconds' % (time.time()-startTime) |
|
197 |
else: |
|
198 |
localizeNibs(options.fromLang, options.toLangs.split('|'), options.nibs.split('|'), options.utf8, options.ignore) |
|
199 |
print 'Nibs updated in %.2f seconds' % (time.time()-startTime) |
|
200 |
Up to file-list Murky.xcodeproj/project.pbxproj:
537 |
537 |
); |
538 |
538 |
runOnlyForDeploymentPostprocessing = 0; |
539 |
539 |
shellPath = /bin/zsh; |
540 |
shellScript = "# -q silences duplicate comments with same key warning\n |
|
540 |
shellScript = "# -q silences duplicate comments with same key warning\n./Localize.py --to English --genstrings \"./**/*.[hm]\" --utf8"; |
|
541 |
541 |
showEnvVarsInLog = 0; |
542 |
542 |
}; |
543 |
543 |
37915E6310E900A00057D687 /* Translate */ = { |
552 |
552 |
); |
553 |
553 |
runOnlyForDeploymentPostprocessing = 0; |
554 |
554 |
shellPath = /bin/sh; |
555 |
shellScript = "# Localize nibs\n |
|
555 |
shellScript = "# Localize nibs\n./Localize.py --from English --to \"French|German\" --nibs \"MainMenu|Projects|Repo\" --utf8\n"; |
|
556 |
556 |
}; |
557 |
557 |
/* End PBXShellScriptBuildPhase section */ |
558 |
558 |
