Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] 0.24+ breaks swifgen structured strings template #748

Open
OSemenovBoyarka opened this issue Jul 23, 2024 · 3 comments
Open

[iOS] 0.24+ breaks swifgen structured strings template #748

OSemenovBoyarka opened this issue Jul 23, 2024 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@OSemenovBoyarka
Copy link

Hello. In our project we use moko-resources only to generate native xml and strings files from KMM module for Android and iOS respectively.
Then we use generated files natively in Android/iOS modules.

For iOS we also use SwiftGen tool to generate Swift enums with strings from Localizable.strings.

We use structured template, that help us to build easy to navigate swift enums, where strings are organized in subenums grouped by specific screen or usecase in the app:
https://github.com/SwiftGen/SwiftGen/blob/stable/Documentation/templates/strings/structured-swift5.md

Starting from the 0.24.0, moko-resources replaces all . symbols in resource keys with _ (before it was done only for Android).
That change makes it impossible to use structured SwiftGen template:
E.g:

<string name="Button.Title.try_again">Try Again</string>

resulting the line in Localizable.strings:

"Button_Title_try_again" = "Try Again";

Before 0.24.0 it was properly converted to:

"Button.Title.try_again" = "Try Again";

Is there any workaround to keep the original behaviour for iOS?

@OSemenovBoyarka
Copy link
Author

It looks like the breaking change introduced in this commit - 128b86c

@Alex009
Copy link
Member

Alex009 commented Jul 24, 2024

hi! we don't think about this use case. i think we can add some option in configuration that will enable different logic.

in 0.24 we do same keys for all platforms because functions that search resource by resource name require same value for all platforms. but you use case interesting and i think we should support it too

@Alex009 Alex009 added this to the 0.25.0 milestone Jul 24, 2024
@Alex009 Alex009 added the enhancement New feature or request label Jul 24, 2024
@OSemenovBoyarka
Copy link
Author

Thanks for the reply! Yep, having the config option will definitely do the trick.
It looks like we need a way to have different keys for platform files and internal resources, used by KMM part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants