Skip to content

Supporting I18n#25

Open
In1quity wants to merge 14 commits intowikimedia-gadgets:masterfrom
In1quity:i18n
Open

Supporting I18n#25
In1quity wants to merge 14 commits intowikimedia-gadgets:masterfrom
In1quity:i18n

Conversation

@In1quity
Copy link
Copy Markdown

@In1quity In1quity commented Sep 14, 2025

Full interface translation support

- Add i18n module with dynamic language file loading
- Add English and Russian translations for core UI
- Integrate i18n into LoadDialog and App.js
- Support for adding new languages without code changes
- Fallback to English if language file not found
- Change i18n loading URL to gitlab-content.toolforge.org
- This provides better reliability and caching for Wikimedia projects
- Localize all hardcoded strings in MainWindow.js (actions, labels, errors)
- Localize all strings in PrefsFormWidget.js (preferences, tooltips)
- Add comprehensive i18n keys for preferences and dialogs
- Update both en.json and ru.json with new translation keys
- Rebuild dist files with localized UI
…ow, TopBar, ParameterWidget, BannerWidget, ParameterListWidget, DropdownParameterWidget, getBanners, and Template
- Fix MainWindow.static.actions localization issue
- Remove code duplication with createActions() function
- Fix non-existent getActions()/setActions() method calls
- Update Russian translation for action-preview button
- Update .gitignore for dist/ and sm/ directories
- Create createBannerWidgetElements() function that returns UI element configs with t() calls
- Initialize BannerWidget.staticElements with English fallback
- Update with localized strings after i18n.load()
- Replace all hardcoded strings in constructor with staticElements references
- Fixes timing issues with i18n loading in BannerWidget
- Add applyI18nStrings() method to update UI elements after i18n.load()
- Call applyI18nStrings() in constructor after i18n.load() promise
- Updates button labels, input placeholders, and field labels dynamically
- Fixes issue where BannerWidget always showed English locale
- Extend createBannerWidgetElements with all UI strings
- Replace direct i18n.t() calls with staticElements references
- Add runtime refresh via applyI18nStrings after i18n.load()
- Fixes timing issues with i18n loading in BannerWidget
…ter key to en/ru\n- Use i18n.t in ParameterListWidget and refresh after i18n.load()
@NovemLinguae
Copy link
Copy Markdown
Member

NovemLinguae commented Sep 14, 2025

Hah. Will be my first review on this repo. Starting me off with the super easy patches I see :P

I'll probably want to do some of https://en.wikipedia.org/wiki/User:Novem_Linguae/Essays/Pros_and_cons_of_moving_a_gadget_to_a_repo#New_wikimedia-gadget_checklist before merging any patches to this repo. In particular getting npm start and npm run deploy set up. Patches for that are welcome. Can look at https://github.com/wikimedia-gadgets/twinkle and https://github.com/wikimedia-gadgets/afc-helper for example code.

If this repo is out of sync with onwiki, we'll also need to write a patch that syncs this repo back up with enwiki.

@NovemLinguae
Copy link
Copy Markdown
Member

Please make migration to ESLint 9.x a separate PR, unless it is necessary to get this PR to pass CI.

@In1quity
Copy link
Copy Markdown
Author

Done :)

@NovemLinguae
Copy link
Copy Markdown
Member

I'm a bit iffy on your other two patches. The concept of this patch looks good though. I plan to merge this one at some point, but will need to get some other housekeeping done first, and will need to do some manual testing.

Have you manually tested this one yet? If not, I've written a manual testing procedure (for testing on test.wikimedia.org) over in #32 - https://github.com/wikimedia-gadgets/rater/pull/32/files

@In1quity
Copy link
Copy Markdown
Author

In1quity commented Sep 16, 2025

https://www.mediawiki.org/wiki/User:Iniquity/rater-core.js
Yes, there is a working build here. As far as I tested, all functions work, but considering that the code is quite complex, I could have missed something. But I would probably first want to transfer the project to standard linter rules, if we are talking about common code. Simply breaking diffs later due to changes in tabs and line endings will be more expensive. #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants