Skip to content

Commit

Permalink
* More localized strings
Browse files Browse the repository at this point in the history
* Fixed: photo captions are incorrectly sized when orientation is flat
  • Loading branch information
joehewitt committed Aug 15, 2009
1 parent d869804 commit adf957b
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 19 deletions.
45 changes: 28 additions & 17 deletions diffstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,24 @@ def mergeProjects(projects, sourceLocaleName, focusedLocaleName=None, verbose=Fa

for project in projects:
sourceStrings = project.condenseStringSourceFiles()

for localeName, localizedStrings in project.locales.iteritems():
if not focusedLocaleName or focusedLocaleName == localeName:
if localizedStrings.name in translations:
translation = translations[localizedStrings.name]
else:
translation = Translation(localizedStrings.name)
translation.open(".", "2")
translations[localizedStrings.name] = translation
sourceStrings.save()

if translation.strings:
if verbose:
localizedStrings.mergeReport(sourceStrings, translation)

localizedStrings.mergeTranslation(sourceStrings, translation)
if not dryRun:
localizedStrings.save()
# for localeName, localizedStrings in project.locales.iteritems():
# if not focusedLocaleName or focusedLocaleName == localeName:
# if localizedStrings.name in translations:
# translation = translations[localizedStrings.name]
# else:
# translation = Translation(localizedStrings.name)
# translation.open(".", "2")
# translations[localizedStrings.name] = translation
#
# if translation.strings:
# if verbose:
# localizedStrings.mergeReport(sourceStrings, translation)
#
# localizedStrings.mergeTranslation(sourceStrings, translation)
# if not dryRun:
# localizedStrings.save()

###################################################################################################

Expand All @@ -99,6 +100,10 @@ def condenseStringSourceFiles(self):
""" Copies all strings from all sources files into a single file."""
sourceStrings = LocalizableStrings(self.sourceLocaleName)

sourceStrings.path = self.__findSourceStringsPath()
if not sourceStrings.path:
sourceStrings.path = os.path.join(self.sourceLocalePath, "Localizable.strings")

for sourceFile in self.stringSourceFiles:
sourceStrings.update(sourceFile)
return sourceStrings
Expand Down Expand Up @@ -194,7 +199,13 @@ def __iterateSourceStrings(self):
filePath = os.path.join(buildPath, fileName)
strings.open(filePath)
yield strings


def __findSourceStringsPath(self):
for name in os.listdir(self.sourceLocalePath):
m = reStringsFileName.match(name)
if m:
return os.path.join(self.sourceLocalePath, name)

def __findSourceStrings(self):
for name in os.listdir(self.sourceLocalePath):
m = reStringsFileName.match(name)
Expand Down
2 changes: 1 addition & 1 deletion src/TTPhotoView.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ - (void)layoutSubviews {

UIDeviceOrientation orientation = TTDeviceOrientation();
CGFloat marginRight = 0, marginLeft = 0, marginBottom = 0;
if (UIInterfaceOrientationIsPortrait(orientation)) {
if (!UIInterfaceOrientationIsLandscape(orientation)) {
marginBottom = TT_ROW_HEIGHT;
} else if (orientation == UIDeviceOrientationLandscapeLeft) {
marginLeft = TTBarsHeight();
Expand Down
2 changes: 1 addition & 1 deletion src/TTTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ - (void)restoreView:(NSDictionary*)state {

- (void)keyboardDidAppear:(BOOL)animated withBounds:(CGRect)bounds {
[super keyboardDidAppear:animated withBounds:bounds];
self.tableView.frame = [self.tableView frameWithKeyboardSubtracted:0];
self.tableView.frame = TTRectContract(self.tableView.frame, 0, bounds.size.height);
[self.tableView scrollFirstResponderIntoView];
[self layoutOverlayView];
[self layoutBannerView];
Expand Down
Binary file modified src/Three20.bundle/de.lproj/Localizable.strings
Binary file not shown.
Binary file modified src/Three20.bundle/en.lproj/Localizable.strings
Binary file not shown.
Binary file modified src/Three20.bundle/es.lproj/Localizable.strings
Binary file not shown.
Binary file modified src/Three20.bundle/fr.lproj/Localizable.strings
Binary file not shown.
Binary file modified src/Three20.bundle/it.lproj/Localizable.strings
Binary file not shown.
Binary file modified src/Three20.bundle/ja.lproj/Localizable.strings
Binary file not shown.

0 comments on commit adf957b

Please sign in to comment.