-
Notifications
You must be signed in to change notification settings - Fork 279
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
Fix and improve i18n support #1258
Fix and improve i18n support #1258
Conversation
c85dca5
to
dbe8424
Compare
And I broke all the tests... Because |
I added a workaround:
Note: in this case ("import" from |
2bd4211
to
1a44c72
Compare
Fixed the Linux build, as well as some |
Look for localizations data in $CONFIG_DIR/messages.
As it turns out, there's no need to manually register Babel' setuptools commands. Add a `babel_options` helper to `plover_build_utils` for use by plugins to easily support translating their UI.
- Don't use a global `_` builtin (which might conflict with other packages): assume the top package will provide a gettext like `_` method. - Fix tool plugins using the wrong language (because the i18n init would happen after importing those modules). - Move the `i18n` support module as well as `messages` directory one level up so it's possible to translate parts of the core too. - Improve the `gettext` `build_ui` hook: automatically add comments giving translators a little more context about each translation. - Configure Babel to extract comments preceding a translation (when they are tagged with `# i18n:`).
42718b4
to
b9da326
Compare
5aaa058
to
b1f6005
Compare
Of course this broke towncrier too... Anyway I think this is finally ready now. |
- use `exec` in `setup.py` - detect `exec` is being used in `plover`, and disable i18n support Note: in this case, we don't want i18n support anyway, since some of the strings we normally translate are used for package metadata.
Can't import `plover` without the necessary dependencies anymore because of i18n support: use the same workaround as for `setup.py`.
Work around towncrier trying to import the `plover` package: fill-in empty `name` and `version` values in the configuration. We don't use the project name in the template, and the version can be specified with `--version` when we do actually need it.
- there's no need to specify the version when drafting - it's better to use `python -m towncrier` (to make sure we're using the correct version / Python interpreter)
b1f6005
to
7bd6194
Compare
And I broke the dictionaries file picker: diff --git a/plover/gui_qt/dictionaries_widget.py b/plover/gui_qt/dictionaries_widget.py
index 74c04688..4ffaf346 100644
--- a/plover/gui_qt/dictionaries_widget.py
+++ b/plover/gui_qt/dictionaries_widget.py
@@ -40,7 +40,7 @@ def _dictionary_filters(include_readonly=True):
formats = sorted(_dictionary_formats(include_readonly=include_readonly))
filters = ['*.' + ext for ext in formats]
# i18n: Widget: “DictionariesWidget”, file picker.
- filters = [_('Dictionaries ({extensions}').format(extensions=' '.join(filters))]
+ filters = [_('Dictionaries ({extensions})').format(extensions=' '.join(filters))]
filters.extend(
# i18n: Widget: “DictionariesWidget”, file picker.
_('{format} dictionaries ({extensions})').format( All good now! I think... |
@Sillabix, @nvdaes: could you update the Italian / Spanish translations? This should be the last translations update before the final release. Here is the latest release, and do check the new i18n documentation. Pretty much everything should be translatable now, except for plugins (plugins manager included). |
Í will update the spanish translation this weekend, thanks. |
Ok, same for me |
Requested by @benoit-pierre in PR openstenoproject#1258 News fragment added in news.d/feature/1165.ui.md news.d/feature/1165.ui.md:
Summary of changes
The bad news is that our i18n support is broken, particularly for plugins that would want to use it. The good news is that since nobody is going to be using it, we can fix without fear of regressions!
See individual commits messages for a detail of the change, as well as the new documentation.
Pull Request Checklist