mac-cain13 / R.swift

Strong typed, autocompleted resources like images, fonts and segues in Swift projects
MIT License
9.49k stars 760 forks source link

R.generated don't generate for stringsdict #646

Closed emelyanovkirill closed 4 years ago

emelyanovkirill commented 4 years ago

R.generated don't generate for stringsdict. If I add "key" = "";, then R.sting.localizable.key(params for dict) works.

dariagss commented 4 years ago

Struggling with this as well. Where exactly do you write "key" = ""? Could you please attach example?

emelyanovkirill commented 4 years ago

@dariagss I write it in Localizable.strings file (for one file is enough). For example, "Plural.LessonCount" = ""; in Localizable.strings (English).

<key>Plural.LessonCount</key>
    <dict>
        <key>NSStringLocalizedFormatKey</key>
        <string>%#@lessonCount@</string>
        <key>lessonCount</key>
        <dict>
            <key>NSStringFormatSpecTypeKey</key>
            <string>NSStringPluralRuleType</string>
            <key>NSStringFormatValueTypeKey</key>
            <string>d</string>
            <key>zero</key>
            <string>no lessons</string>
            <key>one</key>
            <string>1 lesson</string>
            <key>other</key>
            <string>%d lessons</string>
        </dict>
    </dict>

Then R.string.localizable.pluralLessonCount(lessonCount: 5)

dariagss commented 4 years ago

It worked, thank you! But this is so weird, and it doesn't solve the problem of mistyping that all this code generation is for, because I can still change a letter in the dict and r.swift won't tell me :(

emelyanovkirill commented 4 years ago

@dariagss yes, this is workaround only, so I created this issue :)

tomlokhorst commented 4 years ago

Hi, thanks for creating this issue!

Can you elaborate on what you're doing to produce the error?

If I create a new project, add a Localizable.stringsdict file to it with an entry, then R.swift will generate code for that entry.

tomlokhorst commented 4 years ago

Closing due to inactivity.