-
-
Notifications
You must be signed in to change notification settings - Fork 71
i18n support for contributed modes #236
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
Comments
Created by: codeanticode A simple implementation of this support is provided with these changes:
However, an problem with this simple implementation is potential resource collisions, where a mode could overwrite existing strings from the PDE or those used by other modes. Possible ways of handling this problem are adding the name of the mode as a prefix on all the strings, or the full mode package string. Another possibility could be that modes have their own separate language bundle to avoid collisions without needed to add extra prefixes, but fallback to the bundle if a string from the base PDE is requested. |
Created by: codeanticode @benfry I implemented a way to support multiple bundles per mode: https://github.com/codeanticode/processing4/tree/mode-lang-support-with-mult-bundles The functions text(), interpolate(), etc. are overloaded to accept the calling mode, while keeping the original definitions to be used from the main app, see for example here. The idea is that the get() function when called from the mode will first try to get the string from the mode's bundle (if it exists) and then from the base bundle if the key is not present. I think this is one possible solution that solves the problem of colliding keys (priority is given to the mode's strings without overwriting existing keys) and the changes to the API are minor (calling the language methods from the moded only need to add the mode object to the call). BTW, the Language instance uses the hash of the mode object as the key in the map of modes to bundles. Let me know what you think of this approach |
Created by: benfry Ok, added one comment; maybe put this in as a PR so I can review? |
Created by: codeanticode Here: #237 |
Created by: benfry Incorporated a subset of that PR based on the feedback there for 4.0 beta 5. See ddd4b10 |
Created by: github-actions[bot] This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs. |
Created by: codeanticode
Currently, multiple language support is provided for the main Processing app, but this support does not extend to the contributed modes. Each mode could (optionally) provide localized properties files that translate the elements of the mode's UI into different languages.
The text was updated successfully, but these errors were encountered: