diff --git a/Example/Podfile b/Example/Podfile new file mode 100644 index 0000000..c1fab94 --- /dev/null +++ b/Example/Podfile @@ -0,0 +1,3 @@ +platform :ios, '4.3' + +pod 'TTTLocalizedPluralString' diff --git a/Example/Podfile.lock b/Example/Podfile.lock new file mode 100644 index 0000000..b8165cd --- /dev/null +++ b/Example/Podfile.lock @@ -0,0 +1,10 @@ +PODS: + - TTTLocalizedPluralString (0.0.9) + +DEPENDENCIES: + - TTTLocalizedPluralString + +SPEC CHECKSUMS: + TTTLocalizedPluralString: 9813ed30d6babe01440a758cbf2bef85a2138913 + +COCOAPODS: 0.29.0 diff --git a/Example/Pods/BuildHeaders/TTTLocalizedPluralString/TTTLocalizedPluralString.h b/Example/Pods/BuildHeaders/TTTLocalizedPluralString/TTTLocalizedPluralString.h new file mode 120000 index 0000000..e1693b0 --- /dev/null +++ b/Example/Pods/BuildHeaders/TTTLocalizedPluralString/TTTLocalizedPluralString.h @@ -0,0 +1 @@ +../../TTTLocalizedPluralString/TTTLocalizedPluralString.h \ No newline at end of file diff --git a/Example/Pods/Headers/TTTLocalizedPluralString/TTTLocalizedPluralString.h b/Example/Pods/Headers/TTTLocalizedPluralString/TTTLocalizedPluralString.h new file mode 120000 index 0000000..e1693b0 --- /dev/null +++ b/Example/Pods/Headers/TTTLocalizedPluralString/TTTLocalizedPluralString.h @@ -0,0 +1 @@ +../../TTTLocalizedPluralString/TTTLocalizedPluralString.h \ No newline at end of file diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock new file mode 100644 index 0000000..b8165cd --- /dev/null +++ b/Example/Pods/Manifest.lock @@ -0,0 +1,10 @@ +PODS: + - TTTLocalizedPluralString (0.0.9) + +DEPENDENCIES: + - TTTLocalizedPluralString + +SPEC CHECKSUMS: + TTTLocalizedPluralString: 9813ed30d6babe01440a758cbf2bef85a2138913 + +COCOAPODS: 0.29.0 diff --git a/Example/Pods/Pods-TTTLocalizedPluralString-Private.xcconfig b/Example/Pods/Pods-TTTLocalizedPluralString-Private.xcconfig new file mode 100644 index 0000000..24ae185 --- /dev/null +++ b/Example/Pods/Pods-TTTLocalizedPluralString-Private.xcconfig @@ -0,0 +1,5 @@ +#include "Pods-TTTLocalizedPluralString.xcconfig" +GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/TTTLocalizedPluralString" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/TTTLocalizedPluralString" +OTHER_LDFLAGS = -ObjC +PODS_ROOT = ${SRCROOT} \ No newline at end of file diff --git a/Example/Pods/Pods-TTTLocalizedPluralString-dummy.m b/Example/Pods/Pods-TTTLocalizedPluralString-dummy.m new file mode 100644 index 0000000..9d17fb6 --- /dev/null +++ b/Example/Pods/Pods-TTTLocalizedPluralString-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_TTTLocalizedPluralString : NSObject +@end +@implementation PodsDummy_Pods_TTTLocalizedPluralString +@end diff --git a/Example/Pods/Pods-TTTLocalizedPluralString-prefix.pch b/Example/Pods/Pods-TTTLocalizedPluralString-prefix.pch new file mode 100644 index 0000000..95cf11d --- /dev/null +++ b/Example/Pods/Pods-TTTLocalizedPluralString-prefix.pch @@ -0,0 +1,5 @@ +#ifdef __OBJC__ +#import +#endif + +#import "Pods-environment.h" diff --git a/Example/Pods/Pods-TTTLocalizedPluralString.xcconfig b/Example/Pods/Pods-TTTLocalizedPluralString.xcconfig new file mode 100644 index 0000000..e69de29 diff --git a/Example/Pods/Pods-acknowledgements.markdown b/Example/Pods/Pods-acknowledgements.markdown new file mode 100644 index 0000000..f068e5f --- /dev/null +++ b/Example/Pods/Pods-acknowledgements.markdown @@ -0,0 +1,26 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## TTTLocalizedPluralString + +Copyright (c) 2011 Mattt Thompson (http://mattt.me/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission 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. + +Generated by CocoaPods - http://cocoapods.org diff --git a/Example/Pods/Pods-acknowledgements.plist b/Example/Pods/Pods-acknowledgements.plist new file mode 100644 index 0000000..9976048 --- /dev/null +++ b/Example/Pods/Pods-acknowledgements.plist @@ -0,0 +1,56 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2011 Mattt Thompson (http://mattt.me/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission 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. + + Title + TTTLocalizedPluralString + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - http://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Example/Pods/Pods-dummy.m b/Example/Pods/Pods-dummy.m new file mode 100644 index 0000000..ade64bd --- /dev/null +++ b/Example/Pods/Pods-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods : NSObject +@end +@implementation PodsDummy_Pods +@end diff --git a/Example/Pods/Pods-environment.h b/Example/Pods/Pods-environment.h new file mode 100644 index 0000000..621f297 --- /dev/null +++ b/Example/Pods/Pods-environment.h @@ -0,0 +1,14 @@ + +// To check if a library is compiled with CocoaPods you +// can use the `COCOAPODS` macro definition which is +// defined in the xcconfigs so it is available in +// headers also when they are imported in the client +// project. + + +// TTTLocalizedPluralString +#define COCOAPODS_POD_AVAILABLE_TTTLocalizedPluralString +#define COCOAPODS_VERSION_MAJOR_TTTLocalizedPluralString 0 +#define COCOAPODS_VERSION_MINOR_TTTLocalizedPluralString 0 +#define COCOAPODS_VERSION_PATCH_TTTLocalizedPluralString 9 + diff --git a/Example/Pods/Pods-resources.sh b/Example/Pods/Pods-resources.sh new file mode 100755 index 0000000..6fff7a0 --- /dev/null +++ b/Example/Pods/Pods-resources.sh @@ -0,0 +1,68 @@ +#!/bin/sh +set -e + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +install_resource() +{ + case $1 in + *.storyboard) + echo "ibtool --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.xib) + echo "ibtool --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" + ;; + *.xcassets) + ;; + /*) + echo "$1" + echo "$1" >> "$RESOURCES_TO_COPY" + ;; + *) + echo "${PODS_ROOT}/$1" + echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]]; then + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ `xcrun --find actool` ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] +then + case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; + esac + find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/Example/Pods/Pods.xcconfig b/Example/Pods/Pods.xcconfig new file mode 100644 index 0000000..010b411 --- /dev/null +++ b/Example/Pods/Pods.xcconfig @@ -0,0 +1,5 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/TTTLocalizedPluralString" +OTHER_CFLAGS = $(inherited) "-isystem${PODS_ROOT}/Headers" "-isystem${PODS_ROOT}/Headers/TTTLocalizedPluralString" +OTHER_LDFLAGS = -ObjC +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..45b440c --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,964 @@ + + + + + archiveVersion + 1 + classes + + objectVersion + 46 + objects + + 069F6226D14C4E3BA4F9226F + + children + + B3BD6A99BBC64F54BF7A7F7F + + isa + PBXGroup + name + Targets Support Files + sourceTree + <group> + + 107989690B5448F196F75E17 + + children + + BF8CE47ED6AA4BEDA179D180 + 95D4BD3852E344FBA22ECA83 + 4C68C9DDBD1E4DE4A4E9762B + + isa + PBXGroup + name + TTTLocalizedPluralString + path + TTTLocalizedPluralString + sourceTree + <group> + + 14DAF18F419B4005BB9404CC + + buildConfigurationList + 6E1EF87EA10549A9B5DF89CA + buildPhases + + AF3BE3C327D546C4B3889057 + 7E650C1938134ABBB7B79AD4 + + buildRules + + dependencies + + E123062E6B2C4C51A5DEFDD8 + + isa + PBXNativeTarget + name + Pods + productName + Pods + productReference + 616F7AEAF9FB42879B33123D + productType + com.apple.product-type.library.static + + 1618462F35F84C78982710D4 + + children + + 107989690B5448F196F75E17 + + isa + PBXGroup + name + Pods + sourceTree + <group> + + 171A0571518A4B53B2722E14 + + containerPortal + 9641970916594587A10F7F0C + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 30EA988CE32E4414991BBFFE + remoteInfo + Pods-TTTLocalizedPluralString + + 176B05F020034DC58CB0F389 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Pods-acknowledgements.plist + sourceTree + <group> + + 30EA988CE32E4414991BBFFE + + buildConfigurationList + 626EB00F0D824615BA35CC97 + buildPhases + + 3E4171D8614248C2B3BFD105 + AC75E2BE96854FB4A57DD886 + B6ACE0E85B92410B8D0571CB + + buildRules + + dependencies + + isa + PBXNativeTarget + name + Pods-TTTLocalizedPluralString + productName + Pods-TTTLocalizedPluralString + productReference + 418923F1D93B4D71828C444E + productType + com.apple.product-type.library.static + + 332553B3D7104BB68B495575 + + baseConfigurationReference + 6C89C21D8F994C74A93803A6 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + ARCHS + $(ARCHS_STANDARD_32_BIT) + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Pods-TTTLocalizedPluralString-prefix.pch + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 4.3 + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + 375C061C57694BEA8F4F5BD0 + + children + + 616F7AEAF9FB42879B33123D + 418923F1D93B4D71828C444E + + isa + PBXGroup + name + Products + sourceTree + <group> + + 3E4171D8614248C2B3BFD105 + + buildActionMask + 2147483647 + files + + A0BAA2EBB1CF41F0B22C42DA + EB42714CE6894CDC87E482E2 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 418923F1D93B4D71828C444E + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods-TTTLocalizedPluralString.a + sourceTree + BUILT_PRODUCTS_DIR + + 426190A1B6FF4DA2B401230D + + fileRef + C9009AADDD4C42C7A07EAE71 + isa + PBXBuildFile + + 44A609BCF4A04EFE8E197B1C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods.xcconfig + sourceTree + <group> + + 4C68C9DDBD1E4DE4A4E9762B + + children + + B4D13D82766A4D40B1558351 + 6C89C21D8F994C74A93803A6 + FA5EDCD47B5A4FB197DCF673 + C50FBC2199B440C2B954CADD + + isa + PBXGroup + name + Support Files + sourceTree + SOURCE_ROOT + + 5849C0614A904EDFB0A091F2 + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + NO + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES_ERROR + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES_ERROR + COPY_PHASE_STRIP + NO + ENABLE_NS_ASSERTIONS + NO + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES_ERROR + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 4.3 + STRIP_INSTALLED_PRODUCT + NO + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + 594E55B0F04A4038BA13D5E2 + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + Foundation.framework + path + Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/Foundation.framework + sourceTree + DEVELOPER_DIR + + 616F7AEAF9FB42879B33123D + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods.a + sourceTree + BUILT_PRODUCTS_DIR + + 626EB00F0D824615BA35CC97 + + buildConfigurations + + 332553B3D7104BB68B495575 + 72CD377EF1B445E293925555 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 6561254B73A3463483EAACD2 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + path + Pods-acknowledgements.markdown + sourceTree + <group> + + 6C89C21D8F994C74A93803A6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-TTTLocalizedPluralString-Private.xcconfig + sourceTree + <group> + + 6E1EF87EA10549A9B5DF89CA + + buildConfigurations + + B31EF7616F51479C96CAA743 + F7B392BF410646F99DDEDB0E + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 72843961987A402791B22D3B + + fileRef + 594E55B0F04A4038BA13D5E2 + isa + PBXBuildFile + + 72CD377EF1B445E293925555 + + baseConfigurationReference + 6C89C21D8F994C74A93803A6 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + ARCHS + $(ARCHS_STANDARD_32_BIT) + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Pods-TTTLocalizedPluralString-prefix.pch + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 4.3 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + 7E650C1938134ABBB7B79AD4 + + buildActionMask + 2147483647 + files + + 72843961987A402791B22D3B + C739E18179CD4663B3CB4BAF + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 8359EA586A3F4E068E43DF25 + + children + + A8701C86E30B465BA4A6BB77 + 910317B02DF94174A26EC418 + 1618462F35F84C78982710D4 + 375C061C57694BEA8F4F5BD0 + 069F6226D14C4E3BA4F9226F + + isa + PBXGroup + sourceTree + <group> + + 90EE258010404C51900EF6D0 + + buildConfigurations + + 929647DDCAF94DD9A3B3AF39 + 5849C0614A904EDFB0A091F2 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 910317B02DF94174A26EC418 + + children + + B6698B3FA21B4D429C027D36 + + isa + PBXGroup + name + Frameworks + sourceTree + <group> + + 929647DDCAF94DD9A3B3AF39 + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + NO + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES_ERROR + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES_ERROR + COPY_PHASE_STRIP + YES + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES_ERROR + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 4.3 + ONLY_ACTIVE_ARCH + YES + STRIP_INSTALLED_PRODUCT + NO + + isa + XCBuildConfiguration + name + Debug + + 95D4BD3852E344FBA22ECA83 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + TTTLocalizedPluralString.m + sourceTree + <group> + + 9641970916594587A10F7F0C + + attributes + + LastUpgradeCheck + 0500 + + buildConfigurationList + 90EE258010404C51900EF6D0 + compatibilityVersion + Xcode 3.2 + developmentRegion + English + hasScannedForEncodings + 0 + isa + PBXProject + knownRegions + + en + + mainGroup + 8359EA586A3F4E068E43DF25 + productRefGroup + 375C061C57694BEA8F4F5BD0 + projectDirPath + + projectReferences + + projectRoot + + targets + + 14DAF18F419B4005BB9404CC + 30EA988CE32E4414991BBFFE + + + A0BAA2EBB1CF41F0B22C42DA + + fileRef + FA5EDCD47B5A4FB197DCF673 + isa + PBXBuildFile + + A12507DB3C68499896290F6A + + fileRef + 594E55B0F04A4038BA13D5E2 + isa + PBXBuildFile + + A8701C86E30B465BA4A6BB77 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + name + Podfile + path + ../Podfile + sourceTree + SOURCE_ROOT + xcLanguageSpecificationIdentifier + xcode.lang.ruby + + AC75E2BE96854FB4A57DD886 + + buildActionMask + 2147483647 + files + + A12507DB3C68499896290F6A + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + AE1D90A29D1947EC8F3B1A8F + + fileRef + BF8CE47ED6AA4BEDA179D180 + isa + PBXBuildFile + + AF3BE3C327D546C4B3889057 + + buildActionMask + 2147483647 + files + + 426190A1B6FF4DA2B401230D + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + B31EF7616F51479C96CAA743 + + baseConfigurationReference + 44A609BCF4A04EFE8E197B1C + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + ARCHS + $(ARCHS_STANDARD_32_BIT) + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 4.3 + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + B3BD6A99BBC64F54BF7A7F7F + + children + + 44A609BCF4A04EFE8E197B1C + 6561254B73A3463483EAACD2 + 176B05F020034DC58CB0F389 + C9009AADDD4C42C7A07EAE71 + F8C591865D634C37ABA90308 + BA09BF1D822B4184B9458BD6 + + isa + PBXGroup + name + Pods + sourceTree + <group> + + B4D13D82766A4D40B1558351 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-TTTLocalizedPluralString.xcconfig + sourceTree + <group> + + B6698B3FA21B4D429C027D36 + + children + + 594E55B0F04A4038BA13D5E2 + + isa + PBXGroup + name + iOS + sourceTree + <group> + + B6ACE0E85B92410B8D0571CB + + buildActionMask + 2147483647 + files + + AE1D90A29D1947EC8F3B1A8F + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + BA09BF1D822B4184B9458BD6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.script.sh + path + Pods-resources.sh + sourceTree + <group> + + BF8CE47ED6AA4BEDA179D180 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + TTTLocalizedPluralString.h + sourceTree + <group> + + C50FBC2199B440C2B954CADD + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-TTTLocalizedPluralString-prefix.pch + sourceTree + <group> + + C739E18179CD4663B3CB4BAF + + fileRef + 418923F1D93B4D71828C444E + isa + PBXBuildFile + + C9009AADDD4C42C7A07EAE71 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-dummy.m + sourceTree + <group> + + E123062E6B2C4C51A5DEFDD8 + + isa + PBXTargetDependency + target + 30EA988CE32E4414991BBFFE + targetProxy + 171A0571518A4B53B2722E14 + + EB42714CE6894CDC87E482E2 + + fileRef + 95D4BD3852E344FBA22ECA83 + isa + PBXBuildFile + + F7B392BF410646F99DDEDB0E + + baseConfigurationReference + 44A609BCF4A04EFE8E197B1C + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + ARCHS + $(ARCHS_STANDARD_32_BIT) + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 4.3 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + F8C591865D634C37ABA90308 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-environment.h + sourceTree + <group> + + FA5EDCD47B5A4FB197DCF673 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-TTTLocalizedPluralString-dummy.m + sourceTree + <group> + + + rootObject + 9641970916594587A10F7F0C + + diff --git a/Example/Pods/TTTLocalizedPluralString/LICENSE b/Example/Pods/TTTLocalizedPluralString/LICENSE new file mode 100644 index 0000000..11028ca --- /dev/null +++ b/Example/Pods/TTTLocalizedPluralString/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011 Mattt Thompson (http://mattt.me/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission 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. diff --git a/Example/Pods/TTTLocalizedPluralString/README.md b/Example/Pods/TTTLocalizedPluralString/README.md new file mode 100644 index 0000000..5f2df74 --- /dev/null +++ b/Example/Pods/TTTLocalizedPluralString/README.md @@ -0,0 +1,87 @@ +# TTTLocalizedPluralString +## NSLocalizedString with a Count Argument + +> As of iOS 7 and Mac OS X 10.9 Mavericks, Foundation has the ability to specify localized strings according to pluralization and grammar rules. You can find more information about it in the [Localized Property List File](https://developer.apple.com/library/mac/releasenotes/Foundation/RN-Foundation/#//apple_ref/doc/uid/TP30000742-CH2-SW56) section of the Foundation release notes. + +`NSLocalizedString` and its related macros are make localizing Mac and iOS applications relatively straight-forward and simple. It falls down, however, when having to deal with strings whose conjugations change based on a dynamic count value. In such cases, you may have seen code like this: + +``` objective-c +if (count == 1) { + return NSLocalizedString(@"1 Person", nil); +} else { + return [NSString stringWithFormat:NSLocalizedString(@"%d People", nil), count]; +} +``` + +While this works alright for English, you run into problems when targeting other locales. Consider some examples as described in the [Unicode Language Plural Rules](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html): + +* Many Asian languages, like Japanese, Korean, Thai, and Simplified Chinese, do not have plural forms of nouns +* Arabic has several plural forms, including rules for zero, one, two, as well as few, many, and other, which are determined using a rather complicated base 10 divmod operation to determine the parity. + +Fortunately, `TTTLocalizedPluralString` figures all of this out for you. You can use it just as you would `NSLocalizedString`, only in this case, you also have an argument for count. Here is the example from before, this time using `TTTLocalizedPluralString`. + +``` objective-c +return TTTLocalizedPluralString(count, @"Person", nil); +``` + +This macro points to a function that determines the plural rule for the current locale, and then does an `NSBundle` localized string lookup for the corresponding value. In this case, `en.lproj/Localizable.strings` would have two keys for this: `%d Person (plural rule: one)` and `%d Person (plural rule: other)`. Other localizations would only require the keys used by that language (e.g. 1 for Japanese, and 6 for Arabic). + +Here is the full list of plural rules: + +* `zero` +* `one` +* `two` +* `few` +* `many` +* `other` + +## Supported Locales + +- Arabic (`ar`) +- Catalan (`ca`) +- Chinese (Simplified) (`zh-Hans`) +- Chinese (Traditional) (`zh-Hant`) +- Croatian (`cr`) +- Czech (`cs`) +- Danish (`da`) +- Dutch (`nl`) +- English (`en`) +- German (`de`) +- Finish (`fi`) +- Greek (`el`) +- French (`fr`) +- Hebrew (`he`) +- Hungarian (`hu`) +- Indonesian (`id`) +- Italian (`it`) +- Japanese (`ja`) +- Korean (`ko`) +- Latvian (`lv`) +- Malay (`ms`) +- Norwegian Bokmål (`nb`) +- Norwegian Nynorsk (`nn`) +- Polish (`pl`) +- Portuguese (`pt`) +- Romanian (`ro`) +- Russian (`ru`) +- Spanish (`es`) +- Slovak (`sk`) +- Swedish (`sv`) +- Thai (`th`) +- Turkish (`tr`) +- Ukrainian (`uk`) +- Vietnamese (`vi`) + +--- + +## Contact + +Mattt Thompson + +- http://github.com/mattt +- http://twitter.com/mattt +- m@mattt.me + +## License + +TTTLocalizedPluralString is available under the MIT license. See the LICENSE file for more info. diff --git a/Example/Pods/TTTLocalizedPluralString/TTTLocalizedPluralString.h b/Example/Pods/TTTLocalizedPluralString/TTTLocalizedPluralString.h new file mode 100644 index 0000000..15db371 --- /dev/null +++ b/Example/Pods/TTTLocalizedPluralString/TTTLocalizedPluralString.h @@ -0,0 +1,41 @@ +// TTTLocalizedPluralString.h +// +// Copyright (c) 2011 Mattt Thompson (http://mattt.me) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission 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. + +#import + +extern NSString * TTTLocalizedPluralStringKeyForCountAndSingularNoun(NSUInteger count, NSString *singular); +extern NSString * TTTLocalizedPluralStringKeyForCountAndSingularNounForLanguage(NSUInteger count, NSString *singular, NSString *languageCode); + +#define TTTLocalizedPluralString(count, singular, comment) \ +[NSString stringWithFormat:[[NSBundle mainBundle] localizedStringForKey:TTTLocalizedPluralStringKeyForCountAndSingularNoun(count, singular) value:@"" table:nil], count] + +#define TTTLocalizedPluralStringForLanguage(count, singular, languageCode) \ +[NSString stringWithFormat:[[NSBundle mainBundle] localizedStringForKey:TTTLocalizedPluralStringKeyForCountAndSingularNounForLanguage(count, singular, languageCode) value:@"" table:nil], count] + +#define TTTLocalizedPluralStringFromTable(count, singular, tbl, comment) \ +[NSString stringWithFormat:[[NSBundle mainBundle] localizedStringForKey:TTTLocalizedPluralStringKeyForCountAndSingularNoun(count, singular) value:@"" table:(tbl)], count] + +#define TTTLocalizedPluralStringFromTableInBundle(count, singular, tbl, bundle, comment) \ +[NSString stringWithFormat:[bundle localizedStringForKey:TTTLocalizedPluralStringKeyForCountAndSingularNoun(count, singular) value:@"" table:(tbl)], count] + +#define TTTLocalizedPluralStringWithDefaultValue(count, singular, tbl, bundle, val, comment) \ +[NSString stringWithFormat:[bundle localizedStringForKey:TTTLocalizedPluralStringKeyForCountAndSingularNoun(count, singular) value:(val) table:(tbl)], count] diff --git a/Example/Pods/TTTLocalizedPluralString/TTTLocalizedPluralString.m b/Example/Pods/TTTLocalizedPluralString/TTTLocalizedPluralString.m new file mode 100644 index 0000000..0e55d9b --- /dev/null +++ b/Example/Pods/TTTLocalizedPluralString/TTTLocalizedPluralString.m @@ -0,0 +1,526 @@ +// TTTLocalizedPluralString.h +// +// Copyright (c) 2011 Mattt Thompson (http://mattt.me) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission 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. + +#import "TTTLocalizedPluralString.h" + +// Source: Unicode Common Locale Data Repository Plural Rules +// http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html + +static NSString * const kTTTZeroPluralRule = @"zero"; +static NSString * const kTTTOnePluralRule = @"one"; +static NSString * const kTTTTwoPluralRule = @"two"; +static NSString * const kTTTFewPluralRule = @"few"; +static NSString * const kTTTManyPluralRule = @"many"; +static NSString * const kTTTOtherPluralRule = @"other"; + +static NSString * TTTArabicPluralRuleForCount(NSUInteger count) { + switch (count) { + case 0: + return kTTTZeroPluralRule; + case 1: + return kTTTOnePluralRule; + case 2: + return kTTTTwoPluralRule; + default: { + NSUInteger mod100 = count % 100; + if (mod100 >= 3 && mod100 <= 10) { + return kTTTFewPluralRule; + } else if (mod100 >= 11) { + return kTTTManyPluralRule; + } else { + return kTTTOtherPluralRule; + } + } + } +} + +static NSString * TTTSimplifiedChinesePluralRuleForCount(NSUInteger count) { + return kTTTOtherPluralRule; +} + +static NSString * TTTTraditionalChinesePluralRuleForCount(NSUInteger count) { + return kTTTOtherPluralRule; +} + +static NSString * TTTCatalanPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTCroatianPluralRuleForCount(NSUInteger count) { + NSUInteger mod10 = count % 10; + NSUInteger mod100 = count % 100; + + switch (mod10) { + case 1: + switch (mod100) { + case 11: + break; + default: + return kTTTOnePluralRule; + } + case 2: + case 3: + case 4: + switch (mod100) { + case 12: + case 13: + case 14: + break; + default: + return kTTTFewPluralRule; + } + + break; + default: + break; + } + + return kTTTManyPluralRule; +} + +static NSString * TTTCzechPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + case 2: + case 3: + case 4: + return kTTTFewPluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTEnglishPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTFrenchPluralRuleForCount(NSUInteger count) { + switch (count) { + case 0: + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTGermanPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTDanishPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTDutchPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTFinnishPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTGreekPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTHebrewPluralRuleForCount(NSUInteger count) { + NSUInteger mod10 = count % 10; + + switch (count) { + case 1: + return kTTTOnePluralRule; + case 2: + return kTTTTwoPluralRule; + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + break; + default: + switch (mod10) { + case 0: + return kTTTManyPluralRule; + default: + break; + } + } + + return kTTTOtherPluralRule; +} + +static NSString * TTTHungarianPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTIndonesianPluralRuleForCount(NSUInteger count) { + return kTTTOtherPluralRule; +} + +static NSString * TTTItalianPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTJapanesePluralRuleForCount(NSUInteger count) { + return kTTTOtherPluralRule; +} + +static NSString * TTTKoreanPluralRuleForCount(NSUInteger count) { + return kTTTOtherPluralRule; +} + +static NSString * TTTLatvianPluralRuleForCount(NSUInteger count) { + NSUInteger mod10 = count % 10; + NSUInteger mod100 = count % 100; + + if (count == 0) { + return kTTTZeroPluralRule; + } + + if (count == 1) { + return kTTTOnePluralRule; + } + + switch (mod10) { + case 1: + if (mod100 != 11) { + return kTTTOnePluralRule; + } + break; + default: + break; + } + + return kTTTManyPluralRule; +} + +static NSString * TTTMalayPluralRuleForCount(NSUInteger count) { + return kTTTOtherPluralRule; +} + +static NSString * TTTNorwegianBokmalPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTNorwegianNynorskPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTPolishPluralRuleForCount(NSUInteger count) { + NSUInteger mod10 = count % 10; + NSUInteger mod100 = count % 100; + + if (count == 1) { + return kTTTOnePluralRule; + } + + switch (mod10) { + case 2: + case 3: + case 4: + switch (mod100) { + case 12: + case 13: + case 14: + break; + default: + return kTTTFewPluralRule; + } + + break; + default: + break; + } + + return kTTTManyPluralRule; +} + +static NSString * TTTPortuguesePluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTRomanianPluralRuleForCount(NSUInteger count) { + NSUInteger mod100 = count % 100; + + switch (count) { + case 0: + return kTTTFewPluralRule; + case 1: + return kTTTOnePluralRule; + default: + if (mod100 > 1 && mod100 <= 19) { + return kTTTFewPluralRule; + } + break; + } + + return kTTTOtherPluralRule; +} + +static NSString * TTTRussianPluralRuleForCount(NSUInteger count) { + NSUInteger mod10 = count % 10; + NSUInteger mod100 = count % 100; + + switch (mod100) { + case 11: + case 12: + case 13: + case 14: + break; + + default: + switch (mod10) { + case 1: + return kTTTOnePluralRule; + case 2: + case 3: + case 4: + return kTTTFewPluralRule; + default: + break; + } + + } + + return kTTTManyPluralRule; +} + +static NSString * TTTSlovakPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + case 2: + case 3: + case 4: + return kTTTFewPluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTSpanishPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTSwedishPluralRuleForCount(NSUInteger count) { + switch (count) { + case 1: + return kTTTOnePluralRule; + default: + return kTTTOtherPluralRule; + } +} + +static NSString * TTTThaiPluralRuleForCount(NSUInteger count) { + return kTTTOtherPluralRule; +} + +static NSString * TTTTurkishPluralRuleForCount(NSUInteger count) { + return kTTTOtherPluralRule; +} + +static NSString * TTTUkrainianPluralRuleForCount(NSUInteger count) { + NSUInteger mod10 = count % 10; + NSUInteger mod100 = count % 100; + + switch (mod100) { + case 11: + case 12: + case 13: + case 14: + break; + + default: + switch (mod10) { + case 1: + return kTTTOnePluralRule; + case 2: + case 3: + case 4: + return kTTTFewPluralRule; + default: + break; + } + + } + + return kTTTManyPluralRule; +} + +static NSString * TTTVietnamesePluralRuleForCount(NSUInteger count) { + return kTTTOtherPluralRule; +} + +NSString * TTTLocalizedPluralStringKeyForCountAndSingularNoun(NSUInteger count, NSString *singular) { + NSString *languageCode = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0]; + return TTTLocalizedPluralStringKeyForCountAndSingularNounForLanguage(count, singular, languageCode); +} + +NSString * TTTLocalizedPluralStringKeyForCountAndSingularNounForLanguage(NSUInteger count, NSString *singular, NSString *languageCode) { + NSString *pluralRule = nil; + + // Because -hasPrefix is being used here, any three-letter ISO 639-2/3 codes must come before two-letter ISO 639-1 codes in order to prevent, for instance, Konkani (kok) from having Korean (ko) pluralization applied + if ([languageCode hasPrefix:@"ar"]) { + pluralRule = TTTArabicPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"ca"]) { + pluralRule = TTTCatalanPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"zh-Hans"]) { + pluralRule = TTTSimplifiedChinesePluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"zh-Hant"]) { + pluralRule = TTTTraditionalChinesePluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"cr"]) { + pluralRule = TTTCroatianPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"cs"]) { + pluralRule = TTTCzechPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"da"]) { + pluralRule = TTTDanishPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"nl"]) { + pluralRule = TTTDutchPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"en"]) { + pluralRule = TTTEnglishPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"fr"]) { + pluralRule = TTTFrenchPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"de"]) { + pluralRule = TTTGermanPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"fi"]) { + pluralRule = TTTFinnishPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"el"]) { + pluralRule = TTTGreekPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"he"]) { + pluralRule = TTTHebrewPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"hu"]) { + pluralRule = TTTHungarianPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"id"]) { + pluralRule = TTTIndonesianPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"it"]) { + pluralRule = TTTItalianPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"ja"]) { + pluralRule = TTTJapanesePluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"ko"]) { + pluralRule = TTTKoreanPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"lv"]) { + pluralRule = TTTLatvianPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"ms"]) { + pluralRule = TTTMalayPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"nb"]) { + pluralRule = TTTNorwegianBokmalPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"nn"]) { + pluralRule = TTTNorwegianNynorskPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"pl"]) { + pluralRule = TTTPolishPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"pt"]) { + pluralRule = TTTPortuguesePluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"ro"]) { + pluralRule = TTTRomanianPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"ru"]) { + pluralRule = TTTRussianPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"es"]) { + pluralRule = TTTSpanishPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"sk"]) { + pluralRule = TTTSlovakPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"sv"]) { + pluralRule = TTTSwedishPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"th"]) { + pluralRule = TTTThaiPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"tr"]) { + pluralRule = TTTTurkishPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"uk"]) { + pluralRule = TTTUkrainianPluralRuleForCount(count); + } else if ([languageCode hasPrefix:@"vi"]) { + pluralRule = TTTVietnamesePluralRuleForCount(count); + } else { + NSLog(@"Unsupported language: %@", languageCode); + return nil; + } + + return [NSString stringWithFormat:@"%%d %@ (plural rule: %@)", singular, pluralRule]; +} diff --git a/Example/RelativeDateDemo.xcodeproj/project.pbxproj b/Example/RelativeDateDemo.xcodeproj/project.pbxproj index 006f8d1..0b5dc32 100755 --- a/Example/RelativeDateDemo.xcodeproj/project.pbxproj +++ b/Example/RelativeDateDemo.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 12B6BD49055141619D02BF85 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 310461E1E033431E997F45F9 /* libPods.a */; }; 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; @@ -25,6 +26,8 @@ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 2A1519A318B1216F00B9E5DE /* ru */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ru; path = ru.lproj/TesterViewController.xib; sourceTree = ""; }; + 310461E1E033431E997F45F9 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 32CA4F630368D1EE00C91783 /* RelativeDateDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RelativeDateDemo_Prefix.pch; sourceTree = ""; }; 3A188B56173989EB00EF631C /* pt */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = pt; path = pt.lproj/TesterViewController.xib; sourceTree = ""; }; 6143EE561631527000AF766F /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "zh-Hans"; path = "zh-Hans.lproj/TesterViewController.xib"; sourceTree = ""; }; @@ -35,6 +38,7 @@ C00164F21741524100F26B56 /* it */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = it; path = it.lproj/TesterViewController.xib; sourceTree = ""; }; DA300D8F16C8326F002E4C04 /* ja */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ja; path = ja.lproj/TesterViewController.xib; sourceTree = ""; }; DAD012DB16C8311E00AF7B51 /* SORelativeDateTransformer.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = SORelativeDateTransformer.bundle; path = ../SORelativeDateTransformer/SORelativeDateTransformer.bundle; sourceTree = ""; }; + DAF87D503CEC4175A959BAAF /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = ""; }; F202C6FF15DAE09A0090BD6C /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/TesterViewController.xib; sourceTree = ""; }; F202C70115DAE0C90090BD6C /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/TesterViewController.xib; sourceTree = ""; }; F202C70215DAE0D00090BD6C /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = de.lproj/TesterViewController.xib; sourceTree = ""; }; @@ -59,6 +63,7 @@ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, + 12B6BD49055141619D02BF85 /* libPods.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -86,6 +91,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, + DAF87D503CEC4175A959BAAF /* Pods.xcconfig */, ); name = CustomTemplate; sourceTree = ""; @@ -115,6 +121,7 @@ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 1D30AB110D05D00D00671497 /* Foundation.framework */, 288765A40DF7441C002DB57D /* CoreGraphics.framework */, + 310461E1E033431E997F45F9 /* libPods.a */, ); name = Frameworks; sourceTree = ""; @@ -137,9 +144,11 @@ isa = PBXNativeTarget; buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "RelativeDateDemo" */; buildPhases = ( + 7DA36FD2DB6D4F5690647E67 /* Check Pods Manifest.lock */, 1D60588E0D05DD3D006BFB54 /* Sources */, 1D60588F0D05DD3D006BFB54 /* Frameworks */, 1D60588D0D05DD3D006BFB54 /* Resources */, + 5803D7EE007F45E8A8249BE5 /* Copy Pods Resources */, ); buildRules = ( ); @@ -182,6 +191,7 @@ nb, it, ca, + ru, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; projectDirPath = ""; @@ -205,6 +215,39 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 5803D7EE007F45E8A8249BE5 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 7DA36FD2DB6D4F5690647E67 /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 1D60588E0D05DD3D006BFB54 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -235,6 +278,7 @@ AD146F5C17412FC300205BB9 /* nb */, C00164F21741524100F26B56 /* it */, A0B5915C17A2572C000DC886 /* ca */, + 2A1519A318B1216F00B9E5DE /* ru */, ); name = TesterViewController.xib; sourceTree = ""; @@ -244,6 +288,7 @@ /* Begin XCBuildConfiguration section */ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = DAF87D503CEC4175A959BAAF /* Pods.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; @@ -251,7 +296,6 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = RelativeDateDemo_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; INFOPLIST_FILE = "$(SRCROOT)/RelativeDateDemo-Info.plist"; PRODUCT_NAME = RelativeDateDemo; }; @@ -259,6 +303,7 @@ }; 1D6058950D05DD3E006BFB54 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = DAF87D503CEC4175A959BAAF /* Pods.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; diff --git a/Example/ru.lproj/TesterViewController.xib b/Example/ru.lproj/TesterViewController.xib new file mode 100644 index 0000000..531ec19 --- /dev/null +++ b/Example/ru.lproj/TesterViewController.xib @@ -0,0 +1,326 @@ + + + + 1280 + 12C54 + 2843 + 1187.34 + 625.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 1929 + + + IBProxyObject + IBUIDatePicker + IBUILabel + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + + + + 290 + {{0, 91}, {320, 216}} + + + + IBCocoaTouchFramework + 0 + 0 + + en_US + + + America/Los_Angeles + + VFppZgAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAC5AAAABAAAABCepkign7sVkKCGKqChmveQ +y4kaoNIj9HDSYSYQ1v50INiArZDa/tGg28CQENzes6DdqayQ3r6VoN+JjpDgnneg4WlwkOJ+WaDjSVKQ +5F47oOUpNJDmR1gg5xJREOgnOiDo8jMQ6gccIOrSFRDr5v4g7LH3EO3G4CDukdkQ76/8oPBxuxDxj96g +8n/BkPNvwKD0X6OQ9U+ioPY/hZD3L4Sg+CiiEPkPZqD6CIQQ+viDIPvoZhD82GUg/chIEP64RyD/qCoQ +AJgpIAGIDBACeAsgA3EokARhJ6AFUQqQBkEJoAcw7JAHjUOgCRDOkAmtvyAK8LCQC+CvoAzZzRANwJGg +DrmvEA+priAQmZEQEYmQIBJ5cxATaXIgFFlVEBVJVCAWOTcQFyk2IBgiU5AZCRggGgI1kBryNKAb4heQ +HNIWoB3B+ZAesfigH6HbkCB2KyAhgb2QIlYNICNq2hAkNe8gJUq8ECYV0SAnKp4QJ/7toCkKgBAp3s+g +KupiECu+saAs036QLZ6ToC6zYJAvfnWgMJNCkDFnkiAycySQM0d0IDRTBpA1J1YgNjLokDcHOCA4HAUQ +OOcaIDn75xA6xvwgO9vJEDywGKA9u6sQPo/6oD+bjRBAb9ygQYSpkEJPvqBDZIuQRC+goEVEbZBF89Mg +Ry2KEEfTtSBJDWwQSbOXIErtThBLnLOgTNZqkE18laBOtkyQT1x3oFCWLpBRPFmgUnYQkFMcO6BUVfKQ +VPwdoFY11JBW5TogWB7xEFjFHCBZ/tMQWqT+IFvetRBchOAgXb6XEF5kwiBfnnkQYE3eoGGHlZBiLcCg +Y2d3kGQNoqBlR1mQZe2EoGcnO5BnzWagaQcdkGmtSKBq5v+Qa5ZlIGzQHBBtdkcgbq/+EG9WKSBwj+AQ +cTYLIHJvwhBzFe0gdE+kEHT/CaB2OMCQdt7roHgYopB4vs2gefiEkHqer6B72GaQfH6RoH24SJB+XnOg +f5gqkAABAAECAwEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA +AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA +AQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEA +AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA + + + + 313357145.26907599 + + 5 + + + + 292 + {{20, 334}, {280, 61}} + + + + 1 + MC40MDAwMDAwMDYgMC40MDAwMDAwMDYgMC40MDAwMDAwMDYAA + + YES + 7 + NO + IBCocoaTouchFramework + Relative To Now + + 1 + MC45MDE5NjA3OTAyIDAuOTAxOTYwNzkwMiAwLjkwMTk2MDc5MDIAA + + + 3 + MQA + + + 1 + MC4wOTgwMzkyMTcyOSAwLjA5ODAzOTIxNzI5IDAuMDk4MDM5MjE3MjkgMC41AA + + {0, 1} + 1 + 10 + 2 + 1 + + 1 + 17 + + + Helvetica + 17 + 16 + + 280 + + + + 292 + {{20, 20}, {275, 45}} + + + + NO + YES + 7 + NO + IBCocoaTouchFramework + SORelativeDateTransformer Demo + + 1 + MC44MDAwMDAwMTE5IDAuODAwMDAwMDExOSAwLjgwMDAwMDAxMTkAA + + + + 1 + MC4yMDAwMDAwMDMgMC4yMDAwMDAwMDMgMC4yMDAwMDAwMDMAA + + {0, 1} + 1 + 14 + 2 + 1 + + Helvetica-Bold + Helvetica + 2 + 17 + + + Helvetica-Bold + 17 + 16 + + NO + 275 + + + {{0, 20}, {320, 460}} + + + + + 1 + MC4xMzM2NDY1OTMxIDAuMjEwNjIxODQzNCAwLjE1OTgwNDQ2NgA + + NO + + IBCocoaTouchFramework + + + + + + + view + + + + 7 + + + + relativeDateLabel + + + + 12 + + + + datePicker + + + + 13 + + + + datePickerChangedValue: + + + 13 + + 14 + + + + + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 6 + + + + + + + + + + 9 + + + + + 10 + + + + + 11 + + + + + + + TesterViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 14 + + + + + TesterViewController + UIViewController + + datePickerChangedValue: + id + + + datePickerChangedValue: + + datePickerChangedValue: + id + + + + UIDatePicker + UILabel + + + + datePicker + UIDatePicker + + + relativeDateLabel + UILabel + + + + IBProjectSource + ./Classes/TesterViewController.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + YES + 3 + 1929 + + diff --git a/SORelativeDateTransformer.podspec b/SORelativeDateTransformer.podspec index 78a7436..6fc4ddc 100644 --- a/SORelativeDateTransformer.podspec +++ b/SORelativeDateTransformer.podspec @@ -14,5 +14,6 @@ Pod::Spec.new do |s| s.requires_arc = false s.ios.deployment_target = '4.3' s.osx.deployment_target = '10.7' + s.dependency 'TTTLocalizedPluralString' end diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ca.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ca.lproj/SORelativeDateTransformer.strings index 31a9eb2..18d3f4a 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ca.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ca.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/de.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/de.lproj/SORelativeDateTransformer.strings index da13d4e..c8d47fd 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/de.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/de.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/en.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/en.lproj/SORelativeDateTransformer.strings index 6d322d0..195b943 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/en.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/en.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/es.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/es.lproj/SORelativeDateTransformer.strings index adc68f6..d1c4be7 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/es.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/es.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/fr.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/fr.lproj/SORelativeDateTransformer.strings index 7cf5515..d8e89d7 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/fr.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/fr.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/it.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/it.lproj/SORelativeDateTransformer.strings index 82cb3df..4a1a7e8 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/it.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/it.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ja.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ja.lproj/SORelativeDateTransformer.strings index b77c321..f070045 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ja.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ja.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nb.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nb.lproj/SORelativeDateTransformer.strings index 1ad5067..14678c2 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nb.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nb.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nl.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nl.lproj/SORelativeDateTransformer.strings index 428d1bd..955a0b3 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nl.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/nl.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/pt.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/pt.lproj/SORelativeDateTransformer.strings index 9b4e2fa..abc6f01 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/pt.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/pt.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ru.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ru.lproj/SORelativeDateTransformer.strings new file mode 100644 index 0000000..cfe1c88 Binary files /dev/null and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/ru.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hans.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hans.lproj/SORelativeDateTransformer.strings index debc10e..642e51e 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hans.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hans.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hant.lproj/SORelativeDateTransformer.strings b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hant.lproj/SORelativeDateTransformer.strings index 81b5cab..b5badf4 100644 Binary files a/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hant.lproj/SORelativeDateTransformer.strings and b/SORelativeDateTransformer/SORelativeDateTransformer.bundle/zh-Hant.lproj/SORelativeDateTransformer.strings differ diff --git a/SORelativeDateTransformer/SORelativeDateTransformer.m b/SORelativeDateTransformer/SORelativeDateTransformer.m index fd031dd..0470211 100644 --- a/SORelativeDateTransformer/SORelativeDateTransformer.m +++ b/SORelativeDateTransformer/SORelativeDateTransformer.m @@ -7,6 +7,7 @@ */ #import "SORelativeDateTransformer.h" +#import @implementation SORelativeDateTransformer @@ -29,6 +30,10 @@ + (NSBundle *)bundle { return [[SORelativeDateTransformer bundle] localizedStringForKey:key value:nil table:@"SORelativeDateTransformer"]; } +static inline NSString *SORelativeDateLocalizedPluralString(NSInteger count, NSString *singular, NSString *comment) { + return TTTLocalizedPluralStringFromTableInBundle(count, singular, @"SORelativeDateTransformer", [SORelativeDateTransformer bundle], comment); +} + - (id) init { self = [super init]; @@ -106,17 +111,7 @@ - (id) transformedValue:(id)value if (relativeDifference == 0) continue; // Lookup the localized name to use for the data component in our class' strings file. - NSString *localizedDateComponentName = nil; - { - // Map the NSDateComponent method into a localization lookup key corresponding to a suitable calendar unit name, pluralizing the key as appropriate. - // E.g. @selector(year) ==> "year", @selector(month) ==> "month" - - NSString *localizedDateComponentKey = selectorName; - if (labs (relativeDifference) > 1) { - localizedDateComponentKey = [NSString stringWithFormat:@"%@s", selectorName]; - } - localizedDateComponentName = SORelativeDateLocalizedString(localizedDateComponentKey, nil); - } + NSString *localizedDateComponentName = SORelativeDateLocalizedPluralString(labs(relativeDifference), selectorName, nil); // Generate the langugage-friendly phrase representing the relative difference between the input date and now. @@ -127,11 +122,11 @@ - (id) transformedValue:(id)value if (isRelativePastDate) { // Fetch the string format template for relative past dates from the localization file and crunch out a formatted string. NSString *pastDatePhraseTemplate = SORelativeDateLocalizedString(@"formatTemplateForRelativePastDatePhrase", nil); - transformedValue = [NSString stringWithFormat:pastDatePhraseTemplate, relativeDifference, localizedDateComponentName]; + transformedValue = [NSString stringWithFormat:pastDatePhraseTemplate, localizedDateComponentName]; } else { // Fetch the string format template for relative future dates from the localization file and crunch out a formatted string. NSString *futureDatePhraseTemplate = SORelativeDateLocalizedString(@"formatTemplateForRelativeFutureDatePhrase", nil); - transformedValue = [NSString stringWithFormat:futureDatePhraseTemplate, labs (relativeDifference), localizedDateComponentName]; + transformedValue = [NSString stringWithFormat:futureDatePhraseTemplate, localizedDateComponentName]; } // Break from the date components iteration loop after finding the first one with a non-zero relative difference value.