You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i have succesfully integrated SwiftGen for string localization with structured-swift5 template (the same happens with flat-swift5).
So far i only had one Localizable.strings file, which with the default template generates items usable in the form L10n.stringKey.
Now tho, i have added an additional InfoPlist.strings file, and ALL the project's strings get moved under L10n.Localizable.stringKey and L10n.InfoPlist.stringKey for the new ones, understandably to distinguish the file source and avoid conflicts. This tho means i have to change hundreds of lines on code on as many files. Some are dynamic and not as easy to change with find/replace. Beside i dont want to re-run all test batteries.
Is there a way to default to have L10n as default for Localizable (and the rest using su contianers/structs)? WHat is the best approach to follow? Is there some parameter i can change or i have to create a custom template/generator?
I would suggest also, to remove this shortcut or make the L10n.Localizable.stringKey form default, since this is bound to happen for most projects i would guess, but i couldn't find a warning.
Thank you
The text was updated successfully, but these errors were encountered:
Well, we try to reduce the friction for most people.
In general, a project will only have the one Localizable.strings file. And for all those projects, we'd rather they don't have to write longer translation keys.
If a project has multiple files, the built-in templates support this, as you mentioned.
What is an issue is adding a file, and suddenly all your existing keys becoming invalid. Honestly very easy to fix with find/replace, but I can understand the annoyance.
I would not change the default behaviour of the templates though. 2 things you can do:
You could create a custom template do not create the "sub-level" for the localizable strings. You could even go as far as flattening them all into the same level. In any case, beware of collisions ⚠️
You can set the forceFileNameEnum template option, which will always create the file "level" in the generated code, even with one file. Check the template docs for this.
Hello, i have succesfully integrated SwiftGen for string localization with
structured-swift5
template (the same happens withflat-swift5
).So far i only had one
Localizable.strings
file, which with the default template generates items usable in the formL10n.stringKey
.Now tho, i have added an additional
InfoPlist.strings
file, and ALL the project's strings get moved underL10n.Localizable.stringKey
andL10n.InfoPlist.stringKey
for the new ones, understandably to distinguish the file source and avoid conflicts. This tho means i have to change hundreds of lines on code on as many files. Some are dynamic and not as easy to change with find/replace. Beside i dont want to re-run all test batteries.Is there a way to default to have L10n as default for Localizable (and the rest using su contianers/structs)? WHat is the best approach to follow? Is there some parameter i can change or i have to create a custom template/generator?
I would suggest also, to remove this shortcut or make the
L10n.Localizable.stringKey
form default, since this is bound to happen for most projects i would guess, but i couldn't find a warning.Thank you
The text was updated successfully, but these errors were encountered: