Decybel07 / L10n-swift

Localization of the application with ability to change language "on the fly" and support for plural form in any language.
MIT License
315 stars 31 forks source link

Plurals does not work #32

Closed Arideno closed 2 years ago

Arideno commented 2 years ago

Short description of the issue.

Hi, I am using iOS 15. Tried both SPM and Pods. Firstly created "minutes_time.one" and "minutes_time.other" in Localizable.string in en.lproj. When I am trying to call "minutes_time".l10nPlural(1) there is an error No exact matches in call to instance method 'l10nPlural'. Then I've tried to do "minutes_time".l10nPlural(args: [1]), but then I've got "minutes_time.other" version instead of "minutes_time.one"

Environment.

DebugDescription

L10n {
    Language: en
    Preferred language: en
    Supported languages: ["en"]
    Bundles: [
        "/var/containers/Bundle/Application/6353C86E-3F14-4D72-95DE-250F4628A4D1/.../en.lproj"
    ]
}

L10n-swift version: 5.10

Xcode version: 13.2.1 xcodebuild -version

Swift version: 5.5.2 swift -version

Platform(s):

File format(s):

Installation method:

Decybel07 commented 2 years ago

Hi, I can't reproduce your bug, could you please share the project with this bug?

Arideno commented 2 years ago

Here: TestI10n.zip

Screenshot 2022-04-08 at 9 43 20 AM
Decybel07 commented 2 years ago

No exact matches in call to instance method 'l10nPlural'

The above error has been fixed. The latest version 5.10.1 should now be available.


I also checked your test project, the plurals work fine

Arideno commented 2 years ago

Hi, just updated to 5.10.1. The error has been fixed. However, plurals do not work on test project on my computer. Both "number_of_apples".l10nPlural(1) and "number_of_apples".l10nPlural(2) returns "number_of_apples.other" version.

Screenshot 2022-04-09 at 12 31 57 PM Screenshot 2022-04-09 at 12 32 07 PM Screenshot 2022-04-09 at 12 32 16 PM
Decybel07 commented 2 years ago

I have tried many times, however I am unable to reproduce your error. Your example project, regardless of configuration also works.

  1. Try to run tests on this library.
  2. Try to define plurals in Localizable.stringsdict
Arideno commented 2 years ago

I have tested a little bit. It does work on simulator, but on real device it does not...

Arideno commented 2 years ago

Figured it out, I have an error Can't create file:///private/var/containers/Bundle/Application/F71F2D45-EEC2-4418-A56B-3FCD69545005/XXX.app/spmResources/Plural.stringsdict: You don’t have permission to save the file “spmResources” in the folder “XXX”.

Decybel07 commented 2 years ago

Figured it out, I have an error Can't create file:///private/var/containers/Bundle/Application/F71F2D45-EEC2-4418-A56B-3FCD69545005/XXX.app/spmResources/Plural.stringsdict: You don’t have permission to save the file “spmResources” in the folder “XXX”.

This is very useful information. In the latest version 5.10.2 it should be fine