Skip to content

Conversation

@olejnjak
Copy link
Member

@olejnjak olejnjak commented Oct 5, 2022

This change required a bit more code changes that resulted in few bug fixes and potentially a few breaking changes in future .

Fixes:

  • if you had plural rule inside plist prefixed key (e.g. plist.SomeFile.someKey##{one}) it didn't work as expected, should be fixed now and corresponding stringsdict file will be created
  • if you had plist prefixed key with the same name as your strings file, all strings were not generated
  • if you had file only with plurals, empty strings file for non-plurals was generated
  • if key has empty value it is generated to strings file

To still be able to maintain some backwards compatibility I renamed Configuration to ConfigurationV1 and created new ConfigurationV2. V1 is convertible to V2 so if decoding V2 fails, I try to decode V1 and convert it. V2 removed few keys (strings(Dict)FileName, destinationDir) in favor of new defaultFileName and destinations keys. As destinations dictionary requires at least single entry with defaultFileName key, I made defaultFileName required as it makes sense I think.

The process of generating localizations is a bit different now, it used to be

  1. filter out plist prefixed keys and plurals
  2. generate default strings
  3. generate plist strings
  4. generate plurals

From now on it is bit more generic:

  1. group keys by file they belong to (plurals are still combined with non-plurals)
  2. for each group generate stringsfile and stringsdict file if it will be non-empty

The part with this generation is currently not well testable (#19) so no tests were added 😞 I only tested it on few of our projects.

Copy link
Contributor

@IgorRosocha IgorRosocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Co-authored-by: Igor Rosocha <igor.rosocha@ackee.cz>
@olejnjak olejnjak merged commit e6f2b24 into master Oct 6, 2022
@olejnjak olejnjak deleted the location_dict branch October 6, 2022 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants