wikimedia-gadgets / twinkle-core Goto Github PK
View Code? Open in Web Editor NEWCore for localised versions of Twinkle
License: Other
Core for localised versions of Twinkle
License: Other
It's hard to apply i18n on it.
For example:
footerlinks = {
'Twinkle help': 'WP:TW/DOC#batchundelete'
};
I want to change 'Twinkle help' to msg('twinkle-help')
. But object keys cannot be a function. I hope it will be
footerLinks = [
[msg('twinkle-help') as string, 'w:WP:TW/DOC#batchdelete'],
];
or
footerLinks = [
{ label: msg('twinkle-help') as string, page: 'w:WP:TW/DOC#batchdelete' },
];
When Twinkle is deployed as a user script rather than as a gadget, loading the twinkleconfig file and i18n messages can be done in parallel with fetching of the twinkle source file. This should make userscript deployments almost as fast to load and initialise as the gadget deployments.
In many languages, timestamps are always formated in 24-hour-style, for example:
9:00 instead of 9:00 AM and 21:00 instead of 9:00 PM.
Please:
Messages that should support 24-hour timestamps include:
this, this and this
If it's already supported, you just need to inform about it
Thank you!
At the moment Config.ts is a mess with English hard-coded strings for preference texts, and also the hard-coded enwiki-specific CSD criteria data.
Also:
setPortletConfig
function from portlet.ts may better belong over here.There are two message definitions with trailing whitespace.
Trailing whitespace is not supported in translatewiki.net (because it's not supported in MediaWiki pages).
Please remove the trailing whitespace. If it needs to be preserved, try to do that in the code instead of the message.
Wikimedia:Twinkle-prompt-reason-restore/en
'Please specify a reason for the | 'Please specify a reason for the
revert: | revert:'
' |
Wikimedia:Twinkle-summary-prompt/en
'An optional comment for the edit | 'An optional comment for the edit
summary: | summary:'
' |
Orange-i18n is currently being bundled as part of twinkle source code. It could be made a separate (hidden) gadget (like select2 and morebits).
I have override portletName
in this way:
https://github.com/Xi-Plus/twinkle-zhwiktionary/blob/7582f78403302babe9cee5da635947dfe825376e/src/batchdelete.ts#L5
The text in the menu is still "D-batch".
export class BatchDelete extends BatchDeleteCore {
portletName = '批刪';
doesn't work too.
Currently speedyCore.ts has a lot of English Wikipedia specific code and configuration.
JS string i18n libraries used on MediaWiki are all typically written for use in the wgUserLanguage rather than the wgContentLanguage. This poses a problem for Twinkle since many of our i18n string usages are in edited text; and edits saved to wikis should be in the content language of the wiki.
mediawiki.language is a collection of utilities but doesn't offer a message parser. Also, it's based on wgUserLanguage, whichc can't be changed.
mw.Message and mw.jqueryMsg
ns
, formatnum
, SITENAME
and many othersjquery.i18n
banana-i18n
formatnum
templating not supported. Digits are always rendered as Arabic numerals.i18next
Likely options: jquery.i18n and banana-i18n.
Issues with banana-i18n:
None of these libraries appear to support the mw.language.listToText-like function in messages. This makes it seemingly impossible to localise strings of the form "Added tag1, tag2 and tag3 to article" (here, the number of tags is variable).
Greetings! I was intrigued by twinkle starter, and I wanted to adapt other parts of Twinkle to hrwiki.
I'm attempting to have the CSD module work on hrwiki, but I'm having a problem:
I've adapted tagging for CSD, and it works fine, but actual deletion fails.
The error happens in SpeedyCore.ts in line 513 onwards - the messages being requested by getPref() in that part of the code do not have their default values defined in Config.ts - defaultConfig object. As a result, getPrefs returns undefined, and undefined.indexOf(norm) obviously fails.
Please help me resolve this. Thank you!
Twinkle presently can be configured to emit all messages in a single language – which can be configured but defaults to the wiki's wgContentLanguage
. Ideally, strings shown on the interface should be in the user's preferred language (wgUserLanguage
) and strings saved to the wiki (in page texts/edit summaries) or used to scan page texts should be in content language.
msg
function, use msgc
for content lang messages and msgi
for interface lang messages.What about multi-lingual wikis? Multi-lingual wikis have a single wgContentLanguage
, usually English. Twinkle will use that rather than trying to use wgPageContentLanguage
which can vary per-page.
The per-wiki customisations will usually contain many messages. Since we don't expect people to use i18n while writing localisations specific to their wiki (at least https://github.com/wikimedia-gadgets/twinkle-enwiki doesn't), this means that only those interface messages that come from twinkle-core are shown in the interface lang. This results in interfaces with mixed-language interfaces.
This is the reason why I didn't pursue this from the beginning. Is this reason enough not to bother with handling contentlang—userlang duality?
The portlet has been updated to fix display with vector, but the version wasn't bumped, so it's still incorrect on for things that use twinkle-starter (like my in-development twinkle-commons). Bumping the version and creating a new release should fix this.
Not that I think it is of any use, but just for feature parity with https://github.com/wikimedia-gadgets/twinkle.
Currently WarnCore.ts doesn't support the auto-level mode (implemented in the original repo in wikimedia-gadgets/twinkle#777).
i18n deployment workflows are failing: https://github.com/wikimedia-gadgets/twinkle-core/actions/workflows/i18n-deploy.yml, so newly added/updated translations are not getting synced to Gerrit.
When I set my language to zh-tw, Twinkle failed to load messages and fallbacks to en. It's better to load zh-hant messages.
Fallback sequence: zh-tw, zh-hant, zh-hans, en.
Some info: https://www.mediawiki.org/wiki/Manual:Language#Fallback_languages
While async-await is I think currently usable in twinkle clients, it is not currently being used in twinkle-core at all. The reason is mainly that the webpack/babel transpile async-await to generators, which are awkward and can be hard to debug.
However, async-await can simplify things quite a bit and make code more readable in many places.
Not relevant to English language, but nevertheless the official recommendation is to explicitly use it even in English as the syntax guides translators.
The API would need to be used to fetch user genders and pass them into the i18n. Not sure how feasible this is. Would require quite a bit of code changes in modules.
No localisation needed; add only to twinkle-enwiki:
Temporarily port to twinkle-enwiki only, think about implementing in core later:
4 messages are using this syntax. Orange-i18n treats $1 as an operation name and fails. Will probably be better to tweak the library as using HTML entities here (}}$1
) may make the message confusing for translators.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.