Skip to content

Commit f6b65ce

Browse files
author
Owen Yamauchi
committed
Make the --merge functionality of diffstrings actually work
Uncomment the part that actually saves the non-primary locale files.
1 parent d94e648 commit f6b65ce

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

diffstrings.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,25 @@ def mergeProjects(projects, sourceLocaleName, focusedLocaleName=None, verbose=Fa
6666
sourceStrings = project.condenseStringSourceFiles()
6767
sourceStrings.save()
6868

69-
# for localeName, localizedStrings in project.locales.iteritems():
70-
# if not focusedLocaleName or focusedLocaleName == localeName:
71-
# if localizedStrings.name in translations:
72-
# translation = translations[localizedStrings.name]
73-
# else:
74-
# translation = Translation(localizedStrings.name)
75-
# translation.open(".", "2")
76-
# translations[localizedStrings.name] = translation
77-
#
78-
# if translation.strings:
79-
# if verbose:
80-
# localizedStrings.mergeReport(sourceStrings, translation)
81-
#
82-
# localizedStrings.mergeTranslation(sourceStrings, translation)
83-
# if not dryRun:
84-
# localizedStrings.save()
69+
for localeName, localizedStrings in project.locales.iteritems():
70+
if not focusedLocaleName or focusedLocaleName == localeName:
71+
if localizedStrings.name in translations:
72+
translation = translations[localizedStrings.name]
73+
else:
74+
translation = Translation(localizedStrings.name)
75+
translation.open(".")
76+
translations[localizedStrings.name] = translation
77+
78+
if translation.strings:
79+
if verbose:
80+
localizedStrings.mergeReport(sourceStrings, translation)
81+
82+
localizedStrings.mergeTranslation(sourceStrings, translation)
83+
if not dryRun:
84+
localizedStrings.save()
85+
else:
86+
if verbose:
87+
print "no translation.strings for %s, sad" % localeName
8588

8689
###################################################################################################
8790

0 commit comments

Comments
 (0)