moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

[iOS] 0.24+ breaks swifgen structured strings template

Open OSemenovBoyarka opened this issue 7 months ago • 3 comments

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 avatar Jul 23 '24 11:07 OSemenovBoyarka