scelis / twine

Twine is a command line tool for managing your strings and their translations.
Other
840 stars 151 forks source link

Plurals (one, few, many, other etc.) #56

Closed pichirichi closed 10 years ago

pichirichi commented 10 years ago

Both Android and iPhone have a structure to handle single/plurals (one, few, many, other etc.) Any recommendations/idea how to handle this in twine?

iOS - [file].stringsdict

<?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>NUMBER_OF_PEOPLE_KEY</key>
     <dict>
          <key>NSStringLocalizedFormatKey</key>
          <string>%#@num_people_in_room@ in the room</string>
          <key>num_people_in_room</key>
          <dict>
               <key>NSStringFormatSpecTypeKey</key>
               <string>NSStringPluralRuleType</string>
                     <key>NSStringFormatValueTypeKey</key>
                     <string>d</string>
               <key>zero</key>
               <string>No one is</string>
                     <key>one</key>
                     <string>A person is</string>
               <key>two</key>
               <string>Two people are</string>
                     <key>other</key>
                     <string>%d people are</string>
          </dict>
     </dict>
</dict>
</plist>

Android - plurals tags in the xml

    <plurals name="movie_plural">
        <item quantity="one">%d movie</item>
        <item quantity="other">%d movies</item>
    </plurals>
yincrash commented 10 years ago

put plurals in a separate plurals.xml file structured like so:

    <plurals name="movie_plural">
        <item quantity="one">@string/movie_one</item>
        <item quantity="other">@string/movie_other</item>
    </plurals>

then have movie_one and movie_other be in your twine strings..

scelis commented 10 years ago

This is a duplicate of #46