diff --git a/.travis.yml b/.travis.yml index ff32a4a..f6b70fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: objective-c +osx_image: xcode611 before_install: - - brew update - - brew reinstall xctool + - gem install xcpretty -N - gem install cocoapods --pre --quiet - pod setup --silent - pod repo update --silent @@ -9,6 +9,7 @@ script: - pod install - pod lib lint --quick ParseUI.podspec - pod lib lint --use-libraries ParseUI.podspec - - xctool -workspace ParseUI.xcworkspace -scheme 'ParseUI' -sdk iphonesimulator build - - xctool -workspace ParseUI.xcworkspace -scheme 'ParseUIDemo' -sdk iphonesimulator build - - xctool -workspace ParseUI.xcworkspace -scheme 'ParseUIDemo-Swift' -sdk iphonesimulator build + - set -o pipefail + - xcodebuild -workspace ParseUI.xcworkspace -scheme 'ParseUI' -sdk iphonesimulator build | xcpretty -c + - xcodebuild -workspace ParseUI.xcworkspace -scheme 'ParseUIDemo' -sdk iphonesimulator build | xcpretty -c + - xcodebuild -workspace ParseUI.xcworkspace -scheme 'ParseUIDemo-Swift' -sdk iphonesimulator build | xcpretty -c diff --git a/ParseUI.podspec b/ParseUI.podspec index 5d421c2..6ec989b 100644 --- a/ParseUI.podspec +++ b/ParseUI.podspec @@ -27,6 +27,7 @@ Pod::Spec.new do |s| 'ParseUI/Classes/Views/*.h', 'ParseUI/Classes/Cells/*.h', 'ParseUI/Other/*.h' + s.resources = ['ParseUI/Resources/Localization/*.lproj'] s.xcconfig = { 'OTHER_LDFLAGS' => '$(inherited) -undefined dynamic_lookup' } s.frameworks = 'Foundation', 'UIKit', diff --git a/ParseUI.xcodeproj/project.pbxproj b/ParseUI.xcodeproj/project.pbxproj index 892d8c6..9b5c37f 100644 --- a/ParseUI.xcodeproj/project.pbxproj +++ b/ParseUI.xcodeproj/project.pbxproj @@ -70,6 +70,8 @@ 8185BA7C1A642A8B002815C0 /* PFCollectionViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 8185BA7A1A642A8B002815C0 /* PFCollectionViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; 8185BA7D1A642A8B002815C0 /* PFCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8185BA7B1A642A8B002815C0 /* PFCollectionViewCell.m */; }; 819A4B3A1A6808EA00D01241 /* SubtitleImageCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 819A4B391A6808EA00D01241 /* SubtitleImageCollectionViewController.m */; }; + 81B3F26C1AC9EDE000A92677 /* ParseUI.strings in Resources */ = {isa = PBXBuildFile; fileRef = 81B3F26A1AC9EDE000A92677 /* ParseUI.strings */; }; + 81B3F26E1AC9EE0000A92677 /* PFLocalization.h in Headers */ = {isa = PBXBuildFile; fileRef = 81B3F26D1AC9EE0000A92677 /* PFLocalization.h */; }; 81C5993F1A64346000F574E8 /* SimpleCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81C5993E1A64346000F574E8 /* SimpleCollectionViewController.m */; }; 81C599421A6454C900F574E8 /* PaginatedCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81C599411A6454C900F574E8 /* PaginatedCollectionViewController.m */; }; 81C599451A645A9100F574E8 /* PFActivityIndicatorCollectionReusableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 81C599431A645A9100F574E8 /* PFActivityIndicatorCollectionReusableView.h */; }; @@ -186,6 +188,8 @@ 8185BA7B1A642A8B002815C0 /* PFCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PFCollectionViewCell.m; sourceTree = ""; }; 819A4B381A6808EA00D01241 /* SubtitleImageCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubtitleImageCollectionViewController.h; sourceTree = ""; }; 819A4B391A6808EA00D01241 /* SubtitleImageCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SubtitleImageCollectionViewController.m; sourceTree = ""; }; + 81B3F26B1AC9EDE000A92677 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/ParseUI.strings; sourceTree = ""; }; + 81B3F26D1AC9EE0000A92677 /* PFLocalization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PFLocalization.h; sourceTree = ""; }; 81C5993D1A64346000F574E8 /* SimpleCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleCollectionViewController.h; sourceTree = ""; }; 81C5993E1A64346000F574E8 /* SimpleCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimpleCollectionViewController.m; sourceTree = ""; }; 81C599401A6454C900F574E8 /* PaginatedCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaginatedCollectionViewController.h; sourceTree = ""; }; @@ -312,6 +316,7 @@ 810D6BFC19F7F005005B3DB2 /* Extensions */, 810D6C0519F7F005005B3DB2 /* PFImageCache.h */, 810D6C0619F7F006005B3DB2 /* PFImageCache.m */, + 81B3F26D1AC9EE0000A92677 /* PFLocalization.h */, 810D6C0719F7F006005B3DB2 /* Views */, ); path = Internal; @@ -381,6 +386,7 @@ isa = PBXGroup; children = ( 811B095A1A0843B9008B3393 /* Info.plist */, + 81B3F2691AC9EDE000A92677 /* Localization */, ); name = Resources; path = ParseUI/Generated; @@ -536,6 +542,15 @@ path = QueryCollectionViewController; sourceTree = ""; }; + 81B3F2691AC9EDE000A92677 /* Localization */ = { + isa = PBXGroup; + children = ( + 81B3F26A1AC9EDE000A92677 /* ParseUI.strings */, + ); + name = Localization; + path = ParseUI/Resources/Localization; + sourceTree = SOURCE_ROOT; + }; 81C5993C1A64344800F574E8 /* QueryCollectionViewController */ = { isa = PBXGroup; children = ( @@ -736,6 +751,7 @@ 81ED075719F68028009745F4 /* PFLogInViewController.h in Headers */, 810D6C2519F7F006005B3DB2 /* PFPrimaryButton.h in Headers */, 810D6C2319F7F006005B3DB2 /* PFDismissButton.h in Headers */, + 81B3F26E1AC9EE0000A92677 /* PFLocalization.h in Headers */, 810D6C2719F7F006005B3DB2 /* PFTextButton.h in Headers */, 81ED077C19F6809F009745F4 /* PFTableViewCell.h in Headers */, 8185BA781A64241B002815C0 /* PFQueryCollectionViewController.h in Headers */, @@ -790,10 +806,12 @@ isa = PBXNativeTarget; buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "ParseUI" */; buildPhases = ( - D2AAC07A0554694100DB518D /* Headers */, + 81B3F2561AC9E70F00A92677 /* Generate Localizable Strings */, 81E9CD3D19F5781700487B0F /* Convert Images to Code */, + D2AAC07A0554694100DB518D /* Headers */, D2AAC07B0554694100DB518D /* Sources */, D2AAC07C0554694100DB518D /* Frameworks */, + 81B3F25B1AC9E85D00A92677 /* Resources */, ); buildRules = ( ); @@ -884,6 +902,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 81B3F25B1AC9E85D00A92677 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 81B3F26C1AC9EDE000A92677 /* ParseUI.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -932,6 +958,20 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; showEnvVarsInLog = 0; }; + 81B3F2561AC9E70F00A92677 /* Generate Localizable Strings */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Generate Localizable Strings"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "// Extract all strings\nfind $PROJECT_DIR/ParseUI/Classes -name '*.m' -print0 | xargs -0 genstrings -q -o $PROJECT_DIR/ParseUI/Resources/Localization/en.lproj\nmv $PROJECT_DIR/ParseUI/Resources/Localization/en.lproj/Localizable.strings $PROJECT_DIR/ParseUI/Resources/Localization/en.lproj/ParseUI.strings"; + }; 81E9CD3D19F5781700487B0F /* Convert Images to Code */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1043,6 +1083,17 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + 81B3F26A1AC9EDE000A92677 /* ParseUI.strings */ = { + isa = PBXVariantGroup; + children = ( + 81B3F26B1AC9EDE000A92677 /* en */, + ); + name = ParseUI.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 1DEB921F08733DC00010E9CD /* Debug */ = { isa = XCBuildConfiguration; diff --git a/ParseUI/Classes/Cells/PFPurchaseTableViewCell.m b/ParseUI/Classes/Cells/PFPurchaseTableViewCell.m index 48dd30a..4a7968b 100644 --- a/ParseUI/Classes/Cells/PFPurchaseTableViewCell.m +++ b/ParseUI/Classes/Cells/PFPurchaseTableViewCell.m @@ -21,6 +21,7 @@ #import "PFPurchaseTableViewCell.h" +#import "PFLocalization.h" #import "PFRect.h" @interface PFPurchaseTableViewCell () diff --git a/ParseUI/Classes/Internal/Extensions/PFAlertView.m b/ParseUI/Classes/Internal/Extensions/PFAlertView.m index 6ea1c9e..5fbde8a 100644 --- a/ParseUI/Classes/Internal/Extensions/PFAlertView.m +++ b/ParseUI/Classes/Internal/Extensions/PFAlertView.m @@ -21,6 +21,8 @@ #import "PFAlertView.h" +#import "PFLocalization.h" + @implementation PFUIAlertView + (void)showAlertViewWithTitle:(NSString *)title diff --git a/ParseUI/Classes/Internal/PFLocalization.h b/ParseUI/Classes/Internal/PFLocalization.h new file mode 100644 index 0000000..b17310c --- /dev/null +++ b/ParseUI/Classes/Internal/PFLocalization.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014, Parse, LLC. All rights reserved. + * + * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, + * copy, modify, and distribute this software in source code or binary form for use + * in connection with the web services and APIs provided by Parse. + * + * As with any software that integrates with the Parse platform, your use of + * this software is subject to the Parse Terms of Service + * [https://www.parse.com/about/terms]. This copyright notice shall be + * included in all copies or substantial portions of the software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef ParseUI_PFLocalization_h +#define ParseUI_PFLocalization_h + +#undef NSLocalizedString +#define NSLocalizedString(key, comment) \ +[[NSBundle mainBundle] localizedStringForKey:key value:nil table:@"ParseUI"] + +#endif diff --git a/ParseUI/Classes/Internal/Views/PFLoadingView.m b/ParseUI/Classes/Internal/Views/PFLoadingView.m index 8553b39..a9b7688 100644 --- a/ParseUI/Classes/Internal/Views/PFLoadingView.m +++ b/ParseUI/Classes/Internal/Views/PFLoadingView.m @@ -22,6 +22,7 @@ #import "PFLoadingView.h" #import "PFRect.h" +#import "PFLocalization.h" @interface PFLoadingView () diff --git a/ParseUI/Classes/LogInViewController/PFLogInView.m b/ParseUI/Classes/LogInViewController/PFLogInView.m index 53ee36d..56440cb 100644 --- a/ParseUI/Classes/LogInViewController/PFLogInView.m +++ b/ParseUI/Classes/LogInViewController/PFLogInView.m @@ -25,6 +25,7 @@ #import "PFColor.h" #import "PFDismissButton.h" #import "PFImage.h" +#import "PFLocalization.h" #import "PFPrimaryButton.h" #import "PFRect.h" #import "PFTextButton.h" diff --git a/ParseUI/Classes/LogInViewController/PFLogInViewController.m b/ParseUI/Classes/LogInViewController/PFLogInViewController.m index 854a7f7..c196c03 100644 --- a/ParseUI/Classes/LogInViewController/PFLogInViewController.m +++ b/ParseUI/Classes/LogInViewController/PFLogInViewController.m @@ -25,6 +25,7 @@ #import "PFActionButton.h" #import "PFAlertView.h" +#import "PFLocalization.h" #import "PFPrimaryButton.h" #import "PFSignUpViewController.h" #import "PFTextField.h" diff --git a/ParseUI/Classes/ProductTableViewController/PFProductTableViewController.m b/ParseUI/Classes/ProductTableViewController/PFProductTableViewController.m index 2b26f2a..7c5516b 100644 --- a/ParseUI/Classes/ProductTableViewController/PFProductTableViewController.m +++ b/ParseUI/Classes/ProductTableViewController/PFProductTableViewController.m @@ -26,6 +26,7 @@ #import #import "PFAlertView.h" +#import "PFLocalization.h" #import "PFPurchaseTableViewCell.h" static NSString *const PFProductMetadataPriceKey = @"price"; diff --git a/ParseUI/Classes/QueryCollectionViewController/PFQueryCollectionViewController.m b/ParseUI/Classes/QueryCollectionViewController/PFQueryCollectionViewController.m index 299ac3f..534a31a 100644 --- a/ParseUI/Classes/QueryCollectionViewController/PFQueryCollectionViewController.m +++ b/ParseUI/Classes/QueryCollectionViewController/PFQueryCollectionViewController.m @@ -27,6 +27,7 @@ #import "PFCollectionViewCell.h" #import "PFImageView.h" #import "PFLoadingView.h" +#import "PFLocalization.h" static NSString *const PFQueryCollectionViewCellIdentifier = @"cell"; static NSString *const PFQueryCollectionViewNextPageReusableViewIdentifier = @"nextPageView"; diff --git a/ParseUI/Classes/QueryTableViewController/PFQueryTableViewController.m b/ParseUI/Classes/QueryTableViewController/PFQueryTableViewController.m index 023b992..8401fc3 100644 --- a/ParseUI/Classes/QueryTableViewController/PFQueryTableViewController.m +++ b/ParseUI/Classes/QueryTableViewController/PFQueryTableViewController.m @@ -26,6 +26,7 @@ #import "PFActivityIndicatorTableViewCell.h" #import "PFImageView.h" #import "PFLoadingView.h" +#import "PFLocalization.h" #import "PFTableViewCell.h" // Add headers to kill any warnings. diff --git a/ParseUI/Classes/SignUpViewController/PFSignUpView.m b/ParseUI/Classes/SignUpViewController/PFSignUpView.m index 838a4b8..b171404 100644 --- a/ParseUI/Classes/SignUpViewController/PFSignUpView.m +++ b/ParseUI/Classes/SignUpViewController/PFSignUpView.m @@ -24,6 +24,7 @@ #import "PFColor.h" #import "PFDismissButton.h" #import "PFImage.h" +#import "PFLocalization.h" #import "PFPrimaryButton.h" #import "PFRect.h" #import "PFTextButton.h" diff --git a/ParseUI/Classes/SignUpViewController/PFSignUpViewController.m b/ParseUI/Classes/SignUpViewController/PFSignUpViewController.m index 30f649f..c4a5dab 100644 --- a/ParseUI/Classes/SignUpViewController/PFSignUpViewController.m +++ b/ParseUI/Classes/SignUpViewController/PFSignUpViewController.m @@ -25,6 +25,7 @@ #import #import "PFAlertView.h" +#import "PFLocalization.h" #import "PFPrimaryButton.h" #import "PFTextField.h" diff --git a/ParseUI/Resources/Localization/en.lproj/ParseUI.strings b/ParseUI/Resources/Localization/en.lproj/ParseUI.strings new file mode 100644 index 0000000..49bdd2d Binary files /dev/null and b/ParseUI/Resources/Localization/en.lproj/ParseUI.strings differ