diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-04-24 09:45:00 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-04-24 16:18:23 -0700 |
commit | 95613bd7dde7c15669022f69b7f9e611054873c1 (patch) | |
tree | 80a1d02311d3882e16b67663f0254fb50e975878 /platform/osx | |
parent | 7a1d62dc302013e9a6a0be8cde7f2a71e64b5589 (diff) | |
download | qtlocation-mapboxgl-95613bd7dde7c15669022f69b7f9e611054873c1.tar.gz |
[ios, osx] Made OS X SDK localizable
Replaced the iOS-specific ilocalize make rule with a genstrings make rule that creates iOS, OS X, and shared strings files. Moved the override English .stringsdict file under darwin/resources/. Made the default OS X callout view XIB localizable. Made some hard-coded strings in the OS X SDK source localizable.
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/osx.xcodeproj/project.pbxproj | 75 | ||||
-rw-r--r-- | platform/osx/sdk/Base.lproj/Localizable.strings | 30 | ||||
-rw-r--r-- | platform/osx/sdk/Base.lproj/MGLAnnotationCallout.xib (renamed from platform/osx/sdk/MGLAnnotationCallout.xib) | 20 | ||||
-rw-r--r-- | platform/osx/src/MGLAttributionButton.m | 5 | ||||
-rw-r--r-- | platform/osx/src/MGLMapView.mm | 20 |
5 files changed, 132 insertions, 18 deletions
diff --git a/platform/osx/osx.xcodeproj/project.pbxproj b/platform/osx/osx.xcodeproj/project.pbxproj index d3c2f8c9bb..4a74f352f9 100644 --- a/platform/osx/osx.xcodeproj/project.pbxproj +++ b/platform/osx/osx.xcodeproj/project.pbxproj @@ -25,6 +25,10 @@ DA839EA01CC2E3400062CAFB /* MapDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = DA839E9E1CC2E3400062CAFB /* MapDocument.xib */; }; DA839EA21CC2E3400062CAFB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DA839EA11CC2E3400062CAFB /* Assets.xcassets */; }; DA839EA51CC2E3400062CAFB /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = DA839EA31CC2E3400062CAFB /* MainMenu.xib */; }; + DA8933A51CCD287300E68420 /* MGLAnnotationCallout.xib in Resources */ = {isa = PBXBuildFile; fileRef = DA8933A71CCD287300E68420 /* MGLAnnotationCallout.xib */; }; + DA8933AE1CCD290700E68420 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA8933AB1CCD290700E68420 /* Localizable.strings */; }; + DA8933B51CCD2C2500E68420 /* Foundation.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA8933B31CCD2C2500E68420 /* Foundation.strings */; }; + DA8933B81CCD2C2D00E68420 /* Foundation.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DA8933B61CCD2C2D00E68420 /* Foundation.stringsdict */; }; DAC2ABC51CC6D343006D18C4 /* MGLAnnotationImage_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DAC2ABC41CC6D343006D18C4 /* MGLAnnotationImage_Private.h */; }; DAE6C2E21CC304F900DB3429 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = DAE6C2E11CC304F900DB3429 /* Credits.rtf */; }; DAE6C2ED1CC3050F00DB3429 /* DroppedPinAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C2E41CC3050F00DB3429 /* DroppedPinAnnotation.m */; }; @@ -94,7 +98,6 @@ DAE6C3BA1CC31EF300DB3429 /* MGLOpenGLLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3B01CC31EF300DB3429 /* MGLOpenGLLayer.mm */; }; DAE6C3BE1CC31F2E00DB3429 /* default_marker.pdf in Resources */ = {isa = PBXBuildFile; fileRef = DAE6C3BB1CC31F2E00DB3429 /* default_marker.pdf */; }; DAE6C3BF1CC31F2E00DB3429 /* mapbox.pdf in Resources */ = {isa = PBXBuildFile; fileRef = DAE6C3BC1CC31F2E00DB3429 /* mapbox.pdf */; }; - DAE6C3C01CC31F2E00DB3429 /* MGLAnnotationCallout.xib in Resources */ = {isa = PBXBuildFile; fileRef = DAE6C3BD1CC31F2E00DB3429 /* MGLAnnotationCallout.xib */; }; DAE6C3C21CC31F4500DB3429 /* Mapbox.h in Headers */ = {isa = PBXBuildFile; fileRef = DAE6C3C11CC31F4500DB3429 /* Mapbox.h */; settings = {ATTRIBUTES = (Public, ); }; }; DAE6C3C71CC3499100DB3429 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3C61CC3499100DB3429 /* libsqlite3.tbd */; }; DAE6C3D21CC34C9900DB3429 /* MGLGeometryTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3C81CC34BD800DB3429 /* MGLGeometryTests.mm */; }; @@ -165,6 +168,10 @@ DA839EA11CC2E3400062CAFB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; DA839EA41CC2E3400062CAFB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; }; DA839EA61CC2E3400062CAFB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + DA8933A61CCD287300E68420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MGLAnnotationCallout.xib; sourceTree = "<group>"; }; + DA8933AC1CCD290700E68420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; }; + DA8933B41CCD2C2500E68420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Foundation.strings; sourceTree = "<group>"; }; + DA8933B71CCD2C2D00E68420 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Foundation.stringsdict; sourceTree = "<group>"; }; DAC2ABC41CC6D343006D18C4 /* MGLAnnotationImage_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationImage_Private.h; sourceTree = "<group>"; }; DAE6C2E11CC304F900DB3429 /* Credits.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = "<group>"; }; DAE6C2E31CC3050F00DB3429 /* DroppedPinAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DroppedPinAnnotation.h; sourceTree = "<group>"; }; @@ -238,8 +245,7 @@ DAE6C3AF1CC31EF300DB3429 /* MGLOpenGLLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOpenGLLayer.h; sourceTree = "<group>"; }; DAE6C3B01CC31EF300DB3429 /* MGLOpenGLLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLOpenGLLayer.mm; sourceTree = "<group>"; }; DAE6C3BB1CC31F2E00DB3429 /* default_marker.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = default_marker.pdf; sourceTree = "<group>"; }; - DAE6C3BC1CC31F2E00DB3429 /* mapbox.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = mapbox.pdf; path = sdk/mapbox.pdf; sourceTree = SOURCE_ROOT; }; - DAE6C3BD1CC31F2E00DB3429 /* MGLAnnotationCallout.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MGLAnnotationCallout.xib; path = sdk/MGLAnnotationCallout.xib; sourceTree = SOURCE_ROOT; }; + DAE6C3BC1CC31F2E00DB3429 /* mapbox.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = mapbox.pdf; sourceTree = "<group>"; }; DAE6C3C11CC31F4500DB3429 /* Mapbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mapbox.h; path = src/Mapbox.h; sourceTree = SOURCE_ROOT; }; DAE6C3C51CC31F9100DB3429 /* mbgl.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = mbgl.xcconfig; path = ../../build/osx/mbgl.xcconfig; sourceTree = "<group>"; }; DAE6C3C61CC3499100DB3429 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; @@ -337,6 +343,27 @@ name = "Supporting Files"; sourceTree = "<group>"; }; + DA8933A81CCD28D100E68420 /* Kit Resources */ = { + isa = PBXGroup; + children = ( + DA8933AB1CCD290700E68420 /* Localizable.strings */, + DAE6C3BB1CC31F2E00DB3429 /* default_marker.pdf */, + DAE6C3BC1CC31F2E00DB3429 /* mapbox.pdf */, + DA8933A71CCD287300E68420 /* MGLAnnotationCallout.xib */, + ); + name = "Kit Resources"; + sourceTree = "<group>"; + }; + DA8933B21CCD2C0700E68420 /* Foundation Resources */ = { + isa = PBXGroup; + children = ( + DA8933B31CCD2C2500E68420 /* Foundation.strings */, + DA8933B61CCD2C2D00E68420 /* Foundation.stringsdict */, + ); + name = "Foundation Resources"; + path = ../../darwin/resources; + sourceTree = "<group>"; + }; DAE6C31E1CC308BC00DB3429 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -353,10 +380,9 @@ children = ( DAE6C3C11CC31F4500DB3429 /* Mapbox.h */, DAE6C3491CC31DF500DB3429 /* Foundation */, + DA8933B21CCD2C0700E68420 /* Foundation Resources */, DAE6C39E1CC31E7C00DB3429 /* Kit */, - DAE6C3BB1CC31F2E00DB3429 /* default_marker.pdf */, - DAE6C3BC1CC31F2E00DB3429 /* mapbox.pdf */, - DAE6C3BD1CC31F2E00DB3429 /* MGLAnnotationCallout.xib */, + DA8933A81CCD28D100E68420 /* Kit Resources */, DAE6C32C1CC30DB200DB3429 /* Info.plist */, ); name = SDK; @@ -635,9 +661,12 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + DA8933AE1CCD290700E68420 /* Localizable.strings in Resources */, DAE6C3BE1CC31F2E00DB3429 /* default_marker.pdf in Resources */, DAE6C3BF1CC31F2E00DB3429 /* mapbox.pdf in Resources */, - DAE6C3C01CC31F2E00DB3429 /* MGLAnnotationCallout.xib in Resources */, + DA8933A51CCD287300E68420 /* MGLAnnotationCallout.xib in Resources */, + DA8933B51CCD2C2500E68420 /* Foundation.strings in Resources */, + DA8933B81CCD2C2D00E68420 /* Foundation.stringsdict in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -750,6 +779,38 @@ name = MainMenu.xib; sourceTree = "<group>"; }; + DA8933A71CCD287300E68420 /* MGLAnnotationCallout.xib */ = { + isa = PBXVariantGroup; + children = ( + DA8933A61CCD287300E68420 /* Base */, + ); + name = MGLAnnotationCallout.xib; + sourceTree = "<group>"; + }; + DA8933AB1CCD290700E68420 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + DA8933AC1CCD290700E68420 /* Base */, + ); + name = Localizable.strings; + sourceTree = "<group>"; + }; + DA8933B31CCD2C2500E68420 /* Foundation.strings */ = { + isa = PBXVariantGroup; + children = ( + DA8933B41CCD2C2500E68420 /* Base */, + ); + name = Foundation.strings; + sourceTree = "<group>"; + }; + DA8933B61CCD2C2D00E68420 /* Foundation.stringsdict */ = { + isa = PBXVariantGroup; + children = ( + DA8933B71CCD2C2D00E68420 /* en */, + ); + name = Foundation.stringsdict; + sourceTree = "<group>"; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ diff --git a/platform/osx/sdk/Base.lproj/Localizable.strings b/platform/osx/sdk/Base.lproj/Localizable.strings new file mode 100644 index 0000000000..818c82b2ec --- /dev/null +++ b/platform/osx/sdk/Base.lproj/Localizable.strings @@ -0,0 +1,30 @@ +/* Linked part of copyright notice */ +"COPYRIGHT_MAPBOX" = "Mapbox"; + +/* Copyright notice link */ +"COPYRIGHT_MAPBOX_LINK" = "https://www.mapbox.com/about/maps/"; + +/* Linked part of copyright notice */ +"COPYRIGHT_OSM" = "OpenStreetMap"; + +/* Copyright notice link */ +"COPYRIGHT_OSM_LINK" = "http://www.openstreetmap.org/about/"; + +/* Copyright notice prefix */ +"COPYRIGHT_PREFIX" = "© "; + +/* Accessibility title */ +"MAP_A11Y_TITLE" = "Mapbox"; + +/* Label of Zoom In button */ +"ZOOM_IN_LABEL" = "+"; + +/* Tooltip of Zoom In button */ +"ZOOM_IN_TOOLTIP" = "Zoom In"; + +/* Label of Zoom Out button; U+2212 MINUS SIGN */ +"ZOOM_OUT_LABEL" = "−"; + +/* Tooltip of Zoom Out button */ +"ZOOM_OUT_TOOLTIP" = "Zoom Out"; + diff --git a/platform/osx/sdk/MGLAnnotationCallout.xib b/platform/osx/sdk/Base.lproj/MGLAnnotationCallout.xib index edf84a26a7..c8e29bc29e 100644 --- a/platform/osx/sdk/MGLAnnotationCallout.xib +++ b/platform/osx/sdk/Base.lproj/MGLAnnotationCallout.xib @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="NSViewController"> @@ -22,6 +22,14 @@ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <attributedString key="userComments"> + <fragment content="Placeholder for the annotation’s title"> + <attributes> + <font key="NSFont" metaFont="smallSystem"/> + <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> + </attributes> + </fragment> + </attributedString> <connections> <binding destination="-2" name="value" keyPath="representedObject.title" id="3nD-YS-gzq"/> </connections> @@ -33,6 +41,14 @@ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <attributedString key="userComments"> + <fragment content="Placeholder for the annotation’s subtitle"> + <attributes> + <font key="NSFont" metaFont="smallSystem"/> + <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> + </attributes> + </fragment> + </attributedString> <connections> <binding destination="-2" name="value" keyPath="representedObject.subtitle" id="RQf-48-DyH"/> </connections> diff --git a/platform/osx/src/MGLAttributionButton.m b/platform/osx/src/MGLAttributionButton.m index b14d36cffd..e21b860794 100644 --- a/platform/osx/src/MGLAttributionButton.m +++ b/platform/osx/src/MGLAttributionButton.m @@ -1,5 +1,7 @@ #import "MGLAttributionButton.h" +#import "NSBundle+MGLAdditions.h" + @implementation MGLAttributionButton { NSTrackingRectTag _trackingAreaTag; } @@ -10,8 +12,7 @@ self.bezelStyle = NSRegularSquareBezelStyle; // Start with a copyright symbol. The whole string will be mini. - NSMutableAttributedString *attributedTitle = [[NSMutableAttributedString alloc] initWithString:@"© " - attributes:@{ + NSMutableAttributedString *attributedTitle = [[NSMutableAttributedString alloc] initWithString:NSLocalizedStringWithDefaultValue(@"COPYRIGHT_PREFIX", nil, nil, @"© ", @"Copyright notice prefix") attributes:@{ NSFontAttributeName: [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSMiniControlSize]], }]; // Append the specified title, underlining it like a hyperlink. diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm index 280706b798..767bcb81a8 100644 --- a/platform/osx/src/MGLMapView.mm +++ b/platform/osx/src/MGLMapView.mm @@ -80,8 +80,14 @@ struct MGLAttribution { /// URL to open when the attribution button is clicked. NSString *urlString; } MGLAttributions[] = { - { .title = @"Mapbox", .urlString = @"https://www.mapbox.com/about/maps/" }, - { .title = @"OpenStreetMap", .urlString = @"http://www.openstreetmap.org/about/" }, + { + .title = NSLocalizedStringWithDefaultValue(@"COPYRIGHT_MAPBOX", nil, nil, @"Mapbox", @"Linked part of copyright notice"), + .urlString = NSLocalizedStringWithDefaultValue(@"COPYRIGHT_MAPBOX_LINK", nil, nil, @"https://www.mapbox.com/about/maps/", @"Copyright notice link"), + }, + { + .title = NSLocalizedStringWithDefaultValue(@"COPYRIGHT_OSM", nil, nil, @"OpenStreetMap", @"Linked part of copyright notice"), + .urlString = NSLocalizedStringWithDefaultValue(@"COPYRIGHT_OSM_LINK", nil, nil, @"http://www.openstreetmap.org/about/", @"Copyright notice link"), + }, }; /// Unique identifier representing a single annotation in mbgl. @@ -302,12 +308,12 @@ public: [(NSSegmentedCell *)_zoomControls.cell setTrackingMode:NSSegmentSwitchTrackingMomentary]; _zoomControls.continuous = YES; _zoomControls.segmentCount = 2; - [_zoomControls setLabel:@"−" forSegment:0]; // U+2212 MINUS SIGN + [_zoomControls setLabel:NSLocalizedStringWithDefaultValue(@"ZOOM_OUT_LABEL", nil, nil, @"−", @"Label of Zoom Out button; U+2212 MINUS SIGN") forSegment:0]; [(NSSegmentedCell *)_zoomControls.cell setTag:0 forSegment:0]; - [(NSSegmentedCell *)_zoomControls.cell setToolTip:@"Zoom Out" forSegment:0]; - [_zoomControls setLabel:@"+" forSegment:1]; + [(NSSegmentedCell *)_zoomControls.cell setToolTip:NSLocalizedStringWithDefaultValue(@"ZOOM_OUT_TOOLTIP", nil, nil, @"Zoom Out", @"Tooltip of Zoom Out button") forSegment:0]; + [_zoomControls setLabel:NSLocalizedStringWithDefaultValue(@"ZOOM_IN_LABEL", nil, nil, @"+", @"Label of Zoom In button") forSegment:1]; [(NSSegmentedCell *)_zoomControls.cell setTag:1 forSegment:1]; - [(NSSegmentedCell *)_zoomControls.cell setToolTip:@"Zoom In" forSegment:1]; + [(NSSegmentedCell *)_zoomControls.cell setToolTip:NSLocalizedStringWithDefaultValue(@"ZOOM_IN_TOOLTIP", nil, nil, @"Zoom In", @"Tooltip of Zoom In button") forSegment:1]; _zoomControls.target = self; _zoomControls.action = @selector(zoomInOrOut:); _zoomControls.controlSize = NSRegularControlSize; @@ -340,7 +346,7 @@ public: logoImage.alignmentRect = NSInsetRect(logoImage.alignmentRect, 3, 3); _logoView.image = logoImage; _logoView.translatesAutoresizingMaskIntoConstraints = NO; - _logoView.accessibilityTitle = @"Mapbox"; + _logoView.accessibilityTitle = NSLocalizedStringWithDefaultValue(@"MAP_A11Y_TITLE", nil, nil, @"Mapbox", @"Accessibility title"); [self addSubview:_logoView]; } |