-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add a notice that translation keys must be globally unique #5
Comments
Is there a reason they aren't namespaced automatically? I think that would be the better solution since creating globally unique keys that don't conflict with any other mods is going to be a never-ending goose chase. |
Automatic prefixes introduce issues with any calls to Localize, and especially hardcoded keys in assets - you would need to know what the automatic prefix is in order to set up your keys correctly. I think the notice to modders to add their own prefix is likely the most straightforward solution. |
Can you say more about the hardcoded keys in assets? Because it's totally possible that the helper could simply proxy the localize method and add the prefix automatically. I made a helper method in my own project to do just that. Depending on how csv/web transition injections are handled, I imagine it'd be possible to add an automatic prefix on the injection side too. |
Injection side is easy. But in CCL, we're using base game components that take localization keys and use the built in localize methods. There's no way to differentiate between what keys should be prefixed or not if we were to try to patch the localize method. In other mods you'd have to remember to call the langhelper localize function instead of using the existing system. |
Yeah, definitely no way to patch the localize method and get it right. Having to remember to call the right method versus having to remember to prefix all mod keys isn't all that different imo, but the former involves less work for the developer and has a very obvious symptom when it's forgotten, i.e. |
It's not currently clear that translation keys must be globally unique. One could be led to believe by the existence of the
sourceId
passed to the translations injector that they are somehow namespaced automatically.The text was updated successfully, but these errors were encountered: