Skip to content

[suggestion] Use .stringsdict to properly represent plurals in all languages  #277

@reggian

Description

@reggian

I think the usage of stringsdicts would bring DateTools to a new level by offering proper support for all languages without the need to hack the strings files with "__" rules.

Apple Documentation

Simple example of stringsdict for Slovenian:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict>	<key>dt_seconds_ago</key>	<dict>	<key>NSStringLocalizedFormatKey</key>	<string>%#@seconds@</string>	<key>seconds</key>	<dict>	<key>NSStringFormatSpecTypeKey</key>	<string>NSStringPluralRuleType</string>	<key>NSStringFormatValueTypeKey</key>	<string>d</string>	<key>zero</key>	<string>pravkar</string>	<key>one</key>	<string>sekundo nazaj</string>	<key>two</key>	<string>2 sekundi nazaj</string>	<key>few</key>	<string>%d sekunde nazaj</string>	<key>other</key>	<string>%d sekund nazaj</string>	</dict>	</dict> </dict> </plist> 

The example usage (with forced SL locale):

let locale = Locale(identifier: "sl") let format = NSLocalizedString("dt_seconds_ago", comment: "") let string = String(format: format, locale: locale, 1) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions