CalendulaAsteraceae
Welcome to Meta!
Hello, CalendulaAsteraceae. Welcome to the Wikimedia Meta-Wiki! This website is for coordinating and discussing all Wikimedia projects. You may find it useful to read our policy page. If you are interested in doing translations, visit Meta:Babylon. You can also leave a note on Meta:Babel or Wikimedia Forum if you need help with something (please read the instructions at the top of the page before posting there). Also worthwhile acquainting yourself with the functions of global user pages. Happy editing!
Small problem with the English babel
editHi, CalendulaAsteraceae. I am writing to you because you have a lot of programming experience and maybe you can help :) I noticed a small problem with the English babel template. Every other language says something like:
This user has '''native speaker/basic/etc''' knowledge of [[:Category:User xx|language name]].
Notice how the level should be bolded. However the English babel level links back to the user's userpage on Meta instead of being bolded and unlinked. The issue shows up with every English-language level, you can see it happening both on yours (en-N) and on my (en-4) userpage. It does not happen on Wikipedia since there are more usercategories there. I hope you can help and thank you in advance :D Dream Indigo 11:00, 28 May 2024 (UTC)
- I'll take a look at this! Not sure if it's an issue in the Babel extension or the translations… —CalendulaAsteraceae (talk • contribs) 17:38, 27 June 2024 (UTC)
- Thank you! As far as I remember, it only happens here and it was working fine on translatewiki. I may be wrong, though. ✩ Dream Indigo ✩ 23:35, 27 June 2024 (UTC)
Translatable module
editHi!
A little surprise, hopefully a good one :)
I've been testing a new experimental feature, "Translatable modules". Its documentation can be found at mw:Help:Extension:Translate/Message Bundles/Lua reference. Very briefly, it allows Lua modules to store, translate, load, and parse strings in a way that is similar to how it's done in MediaWiki extensions, so that you won't have to store translated strings as hard-coded Lua arrays and write a lot of manual code with conditions and concatenations.
I've chosen the module Module:User Wikimedia project, to which you contributed a lot, as the first one on which I'm going to test it. I didn't do anything with your original code, but created a copy at Module:User Wikimedia project translatable. I haven't yet converted all the possible strings to the new framework yet, but only the ones that were in the function project_text()
.
The English strings are at User:Amire80/User Wikimedia project mb in JSON format. They are translatable by clicking the "Translate this message bundle" link at the top. I copied all the existing translations and made necessary modifications in them. So now, for example, you can use {{GENDER}}
in the message instead of writing getContentLanguage():gender()
for every language that needs it; you can use parameters like $1, $2, etc.; and you can use wikitext in the English srtings and in the translations instead of concatenating [[
and ]]
.
You can see examples of the most important functions for handling the strings in function project_text()
:
tmb = require 'mw.ext.translate.messageBundle'
- loading the library ("tmb" stands for "translatabe message bundle")tmb.new()
- loading the messagesmb_lang1:t()
- loading a specific message:params()
- sending parameters to the message ($1, $2, etc.)frame:preprocess()
- parsing{{GENDER}}
It's probably not perfect yet, but what do you think about this direction? I'm pretty sure that all the other strings can be converted to this system, too including support for language and project names. Eventually, the strings can be fully separated from the code. Amir E. Aharoni (WMF) (talk) 13:35, 4 March 2025 (UTC)
- I think this is a great idea! —CalendulaAsteraceae (talk • contribs) 01:32, 5 March 2025 (UTC)