-
Notifications
You must be signed in to change notification settings - Fork 8
Rework localization #55
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
Open
jhsoby
wants to merge
26
commits into
main
Choose a base branch
from
onwiki_i18n
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add i18n function that will output a substing of Module:UKB with the getMessage function, instead of the current gettext setup.
Replace the _() function with the new i18n() function in all
of the main files, except for the "{{Kolonner}}" template,
which I'll have to figure out something else for.
Remove code that has been commented out for various reasons; most (all?) of this is several years old, and I doubt even Dan Michael will remember what the purpose of it is/was.
Turns out the approach I first tried, with substing the module,
had a major flaw: Expansion limits. After relatively few substitutions,
all it would result in was Scribunto/Lua errors instead.
So this approach instead uses a new function from that module that
outputs all the i18n stuff we have in JSON, and then parses that JSON
and makes some substitutions as necessary.
I've chosen to make it `subst:` all magic words except for {{formatnum:}},
so that the end users shouldn't actually see {{PLURAL:}} etc.
Insert the UKB module with its getMessage() function if the message key doesn't exist. This will let the module track uses of non-existing messages, so that can be fixed via the bot's code or fixed by adding the message to the Data file on Commons.
Remove the hard-coding of the {{kolonner}} template; replace it
with a potential config line, or if there is no config, an
empty div element with a special class (so that the functionality
of {{kolonner}} can be added to a UKBot-specific TemplateStyles
page).
This partially fixes #23.
No longer used for anything.
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 40 out of 43 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- MANIFEST.in: Language not supported
- Makefile: Language not supported
- locale/messages.pot: Language not supported
Comments suppressed due to low confidence (1)
ukbot/contest.py:664
- [nitpick] The log message is unclear; consider rewording it to something like 'Sending receipt to %s' to improve readability.
logger.info('Sending %s a deliver_receipt_to_leaders', page.name)
DiFronzo
reviewed
Apr 10, 2025
Clarify message and fix typo discovered by Copilot, change bot's contact email in user agent per @DiFronzo.
17 tasks
Clarify message and fix typo discovered by Copilot, change bot's contact email in user agent per @DiFronzo.
Exchange setup.py for the more modern approach, pyproject.toml, update requirements.txt based on current requirements, and add bot version to ukbot.py output. This fixes #59.
It confirms that standard prefixes like 'en' and 'de' are properly
registered, while also validating the behavior with edge cases such as
an empty string (''), None, capitalized forms like 'UPPERcase', and
prefixes with leading/trailing whitespace like ' en '. The tests also
verify that the class remains working when unknown or invalid prefixes
(like 'zz', 'not_in_map', or the integer 42) are passed and they are not
added to the interwikimap.
<!--
This PR fixes the Issue
-->
- [x] 🍕 Feature
- [x] ✅ Test
Fixes #79
- [x] 👍 yes
- [ ] 📜 README.md
- [ ] 📖 own file under the docs folder
- [x] 🙅 no documentation needed
<!--
Write about changing templates or modules on-wiki in order to accomodate
changes in this PR
-->
…ct (#56) First draft to issue templates, contributing guidelines, and code of conduct.
Exchange setup.py for the more modern approach, pyproject.toml, update requirements.txt based on current requirements, and add bot version to ukbot.py output. This fixes #59.
#88) …3" in jobs.yaml ## Description There was a custom Elokuun kuvitustalkoot config in 2023, probably because of incorrect competition settings, and it was worked around by using a different competition ID. However, since it only worked in 2023, I have now reverted the jobs.yaml back to the multiyear config. NOTE: This is also updated now directly to production as the competition is already started.
Note: I did the change already directly to production to test it so it needs to be reverted from ukbot/rules/image.py before pulling it.
…warnings for missing categories and unrecognized wikis (#67) This PR adds enhanced error handling in contest filters, logging non-fatal warnings for missing categories and unrecognized wikis. It has been tested, but there may still be edge cases I haven’t considered. It will show in console like this:  On wiki[[1](https://no.wikipedia.org/w/index.php?title=Bruker:Premeditated/Sandkasse5&oldid=25156842)]:  - [ ] 🍕 Feature - [X] 🐛 Bug Fix - [ ] 📝 Documentation Update - [ ] 🎨 Style - [x] 🧑💻 Code Refactor - [ ] 🔥 Performance Improvements - [ ] ✅ Test - [ ] 🤖 Build - [ ] 🔁 CI - [ ] 📦 Chore - [ ] ⏩ Revert Fixes #62 - [X] 👍 yes - [ ] 🙅 no, because they aren't needed - [ ] 🙋 no, because I need help - [ ] 📜 README.md - [ ] 📖 own file under the docs folder - [X] 🙅 no documentation needed perform? No --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use localization on-wiki (via a page in the Data namespace on Commons) for all localizable strings, in conjunction with the new UKB module. With this change, the module will be used both for localization of on-wiki templates and texts, in addition to all localizable text used in the bot and output by the bot.
As part of this rework, I have also removed a lot of commented-out WIP code or code used for testing/debugging, and fixed some instances of hard-coded Norwegian things (like the
{{Kolonner}}template).Warning
Do not merge until the new UKB module is in place on all wikis that have contests!