Latest 1.0.9
License APACHE


iOS 6+ Plurals Localization Library

iOS (pre-iOS 7) localization did not support plural functionality out of the box. The ios-i18n library was designed to bridge that gap and provide a means for developers to seamlessly integrate plurals into their localized apps across any number of locales.

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 about this in the Handling Noun Plurals and Units of Measurement section of the Internationalization and Localization Guide.

ios-i18n is not compatible with Apple’s implementation, and does not handle new ".stringsdict" resource files.


Via CocoaPods

Update your Podfile with

pod 'Smartling.i18n', '~> 1.0'

Framework bundle

  1. Download Smartling.i18n.framework.tar.gz
  2. Unpack and drag Smartling.i18n.framework to your project’s Frameworks group.
  3. In the Build Settings of your target add -ObjC to Other Linker Flags.
  4. #import <Smartling.i18n/SLLocalization.h>


Carthage compatible


github "Smartling/ios-i18n"



int number = 42;
NSString *format = SLPluralizedString(@"%d apples", number, @"Comment");
NSString *text = [NSString stringWithFormat:format, number];


There are four functions to retrieve pluralized string, similar to NSLocalizedString:

NSString * SLPluralizedString(NSString *key, number, NSString *comment)
NSString * SLPluralizedStringFromTable(NSString *key,
    NSString *tableName,
    NSString *comment)
NSString * SLPluralizedStringFromTableInBundle(NSString *key,
    NSString *tableName,
    NSBundle *bundle,
    NSString *comment)
NSString * SLPluralizedStringWithDefaultValue(NSString *key,
    NSString *tableName,
    NSBundle *bundle,
    NSString *defaultValue,
    NSString *comment)

number can be any primitive type (int, long, float, double), or NSNumber.


Base internationalization

When using Base internationalization, Localizable.strings files should be in language-specific folders (like en.lproj), not in Base.lproj folder.


ios-i18n implements resource fallback for each key query. At runtime, SLPluralizedString retrieves string whose localization most closely matches the preferred language of the user.

In contrast, Apple’s implementation of NSLocalizedString first selects appropriate localization table, then uses this table for all subsequent queries. For more details on this mechanism, see Support for Internationalization

Extended .strings format

ios-i18n extends standard .strings file format with pluralized variants.

The extended syntax for key is: KEY##{rule}.
Where KEY is the original key string, and rule is one of plural rules: zero, one, two, few, many, other.

The rule portion of the full key conforms to the CLDR spec on plural forms. The ios-i18n library will load a particular translation following the same rules as defined under CLDR.

Sample resource files for key string %d songs found:

/* Number of songs from search results */
"%d songs found##{one}" = "One song found";
"%d songs found##{other}" = "%d songs found";
/* Number of songs from search results */
"%d songs found##{one}" = "Найдена %d песня";
"%d songs found##{few}" = "Найдено %d песни";
"%d songs found##{many}" = "Найдено %d песен";
"%d songs found##{other}" = "Найдено %d песен";

Copyright and license

Copyright 2013 Smartling, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Latest podspec

    "name": "Smartling.i18n",
    "version": "1.0.9",
    "summary": "iOS Plurals Localization Library",
    "homepage": "",
    "license": {
        "type": "APACHE",
        "file": "LICENSE"
    "authors": "Pavel Ivashkov",
    "source": {
        "git": "",
        "tag": "v1.0.9"
    "source_files": "Smartling.i18n/*.{h,m,c}",
    "requires_arc": true

Pin It on Pinterest

Share This