Commit graph

216 commits

Author SHA1 Message Date
C. Scott Ananian
450fe7fcd8 Make {{#language}} consistent with {{#dir}} and {{#bcp47}}
Add the same no-arg options for language code that
{{#dir}} and {{#bcp47}} have, for consistency:
* `{{#language}}` will return the name of the *target language*
  (for articles, the content language; for messages, the user language)

The default value for the "in language" argument should be the autonym.
This was working previously but only via a baroque code flow path for
invalid language codes.  Make this a bit clearer and add tests.

Since non-autonym language code translations are added via the
[[Extension:CLDR]] in production, hook LanguageGetTranslatedLanguageNames
in the ParserTestRunner to ensure that we can test this.

Followup-To: Ice1c671c5b3cc077d2bb80ea5dc25c5eabbfeb36
Followup-To: I19c3e91a924e080f37dc95a0d4e61493583b533e
Change-Id: Ibf6e7f194cc056eadb48a5ad8e6d01a761d9351c
2024-07-30 20:27:17 +00:00
Stang
aa3fac56b4 Remove twn-related comment from languages/messages/* files
Bug: T304802
Change-Id: Iccacf6288d758e526c95df69861385a4ac2d0f55
2022-11-13 22:46:44 -05:00
Timo Tijhof
939700e8ff language: Continue doc Languages subgroup for msg files and subclasses
Follows-up I301f471f86ba2.

For ease of navigation, move Converter subclasses to a group called
"Languages", which for documentation purposes is a subgroup of
"Language". The next commit does the same for Messages* files,
and Language subclasses (done separately for ease of review).

Change-Id: If1cef9aa15f536ebaedd4477ad7453426e7f3b85
2022-06-29 00:13:45 +00:00
Umherirrender
7f28fe35b8 Sort magic words alises alphabetically in static language files
Use @phpcs-require-sorted-array from new codesniffer release 32.0.0

Similiar to special page alias in
I827d1f5010d000609324ec398beeb142d9bac299

Bug: T255826
Change-Id: I7b7cbf0c03714001609437af68fe16e06930cc33
2021-03-06 16:21:51 +01:00
Umherirrender
673477a4b4 Sort special page alises alphabetically
Use @phpcs-require-sorted-array from new codesniffer release 32.0.0

Bug: T255826
Change-Id: I827d1f5010d000609324ec398beeb142d9bac299
2020-10-30 09:59:17 +01:00
Bartosz Dziewoński
a64779f7ef MessagesCu: Fix invalid characters in namespace aliases
In commit 5940aa6344 in 2008 (SVN r35745),
these were accidentally changed from U+F011 (a private use area character)
to U+0011 (a control character). The control characters are certainly
incorrect, as they can't even be used in MediaWiki page titles. Having
a private use area character here is surprising to me, but it was
apparently used since 2006 as a substitute for U+A657, which was only
introduced in Unicode 5.1 in April 2008, hence the aliases.

I noticed this problem when I was doing some work analyzing MediaWiki's
date formats, and my editor warned me that this is a "binary file" :)

Change-Id: I5df29b0072d6dec8dcb8c7492d8b9623c93fdbf3
2019-10-08 23:52:41 +02:00
Fomafix
ce6f7faadd Remove trailing empty lines in PHP
Performed using
find . -name \*.php -exec sed -i -e :a -e '/./,$!d;/^\n*$/{$d;N;};/\n$/ba' {} \;

Change-Id: I5d0627f94c73690cf3a8a453539c22c760c2aa60
2017-01-16 22:06:43 +01:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Niklas Laxström
b382478944 Cleanup message file documentation
* Interface strings are now elsewhere
* MessagesQQQ no longer exists
* Prefer https for translatewiki.net

Change-Id: I76652ea94cca80441cd5d978029e4707ee41c4fd
2014-06-05 14:06:25 +00:00
Siebrand Mazeland
0dd91d5396 Migrate translations for core to JSON format
Largest patch set in the history of MediaWiki!

Change-Id: I918cfdc46c099017ca3622d1bcbbdd30c4fd00f6
2014-04-01 21:25:43 +00:00
Translation updater bot
e14f84ab9c Localisation updates from https://translatewiki.net.
Change-Id: I18970accbce3b383e4ad89df2b5cd0d638861e26
2014-03-21 20:46:11 +00:00
Translation updater bot
78c3af541b Localisation updates from https://translatewiki.net.
Change-Id: Ia03f6dcf21ee8e589758e039566adb661893804f
2014-03-10 21:21:57 +00:00
Translation updater bot
898aff7d3f Localisation updates from https://translatewiki.net.
Change-Id: I224ceef57736f6567735a3d1e19f1ec0fddb515e
2013-12-23 20:44:54 +00:00
Translation updater bot
9ffcc282ab Localisation updates from https://translatewiki.net.
Change-Id: Id4b89fcef61ccf1e329710f6beff9398669fdadb
2013-12-08 20:26:31 +00:00
Translation updater bot
4767a49bf9 Localisation updates from https://translatewiki.net.
Change-Id: Id32d5c87533081016e6a00312703f450782a1d6d
2013-12-07 10:46:45 +00:00
Translation updater bot
5531631535 Localisation updates from https://translatewiki.net.
Change-Id: I91af046a42d410457d6ccb6ce44657a29d184434
2013-12-05 21:22:40 +00:00
Translation updater bot
f3eacb22b9 Localisation updates from https://translatewiki.net.
Change-Id: Ic4c5e76d04630a9da5bde0590db09b55d30132ec
2013-12-04 20:29:19 +00:00
Translation updater bot
a13c897f4d Localisation updates from https://translatewiki.net.
Change-Id: I5c7c2cde9b44ccfd3edd8101d677e2d8f1797982
2013-12-02 20:32:58 +00:00
Translation updater bot
e7e842ad37 Localisation updates from https://translatewiki.net.
Change-Id: Iac7415ec17a0a30026e8c542f5ddd98d67b35d59
2013-11-24 20:26:31 +00:00
Translation updater bot
09519accc3 Localisation updates from http://translatewiki.net.
Change-Id: I5a74c20de10a3203ff81d453de6c739a8a476081
2013-11-18 06:37:41 +00:00
Brad Jorsch
db9c4cb3cf Remove linkprefix message, add $linkPrefixCharset
The existing "linkprefix" message is unlikely to be accurately
customized by message translators (as shown by the fact that, of the 10
distinct customizations prior to Iaa7eaa44 (which made them even more
complicated), 3 were broken or entirely ineffective, 1 was half
ineffective, and 2 more seem to have included the Latin-1 Supplement by
accident) or by local wiki admins. So, like linktrail before it, let's
move it out of the system messages and into a separate language
variable.

At the same time, let's make it a simple character set (like
$wgLegalTitleChars) rather than a complicated regular expression. The
complicated regex now lives in the parser.

This also adjusts the output of the API's action=query&meta=siteinfo and
adds an accessor parallel to the linkTrail accessor to Language.

Note the following changes that are not simply extracting the existing
charset from the linkprefix message for $linkPrefixCharset:
* The En message matched all non-ASCII UTF-8 characters by matching the
  component bytes (\\x80-\\xff). The new character set is equivalent.
* Various languages were identical to En and so have no $linkPrefixCharset
  set. These are: Ary Az Ce Ga Id Ka Kiu Km Ltg Mk Ms Ne Nn Ro Roa_tara Sc Si
  Sr_ec Sr_el Tl Tt_cyrl Tt_latn Ug_arab War
* Cu, Uk, and Udm are changed to match any number of „ or « in the prefix.
* Cv tried to include "«" that was redundant to the range \\x80-\\xff
  (see En comment). This was removed.
* Diq was entirely bogus, and so was removed.
* Gu included many additional UTF-8 characters that are redundant to the
  range \\x80-\\xff (see En comment). These were removed, and the
  resulting character set is equivalent to En.
* Mt has been broken since it was introduced in r37242. The charset used is
  equivalent to the broken regex.

Bug: 56031
Change-Id: I3369851b33113fc118a1bace38f3ac310cdd9725
2013-10-29 19:06:15 -04:00
Translation updater bot
ab65effabe Localisation updates from http://translatewiki.net.
Change-Id: I7d7dfd1a1e1a395c639b30489bacceedfbfc6330
2013-10-24 20:56:36 +00:00
Brad Jorsch
c800638273 Improve linkprefix regular expressions
The regular expression in the linkprefix message is run against the
entire page up to each wikilink, and is expected to capture one group
having everything except the prefix and another having only the prefix.
For long pages this winds up being a lot of text, so inefficient regular
expressions are going to cause problems.

The current regex is this:

  /^(.*?)([a-zA-Z\\x80-\\xff]+)$/sD

This is not efficient: it will scan through the string trying to match
against every run of one or more letters/non-ASCII characters,
backtracking at every one except possibly the last. The only reason this
hasn't been a huge problem everywhere is because only a few languages
have this feature enabled.

This change replaces this with this regex:

  /^((?>.*(?<![a-zA-Z\\x80-\\xff])))(.+)$/sD

This is rather more efficient: it will grab the whole string (which is
actually fast even for huge strings), then back off character by
character until it finds one that isn't a letter/non-ASCII.

Note that the above could be simplified somewhat:

  /^((?>.*[^a-zA-Z\\x80-\\xff]|))(.+)$/sD

The performance improvement here is minor, and Gujarati, Church Slavic,
Udmurt, and Ukrainian would still need the other style for their current
implementations.

For Gujarati, we also use another regex trick: a look-behind assertion
in PCRE must be fixed length, so something like (?<!a|bb) won't work.
But that regex fragment is equivalent to (?<!a)(?<!bb) which is allowed,
so we use that instead.

Bug: 52865
Change-Id: Iaa7eaa446b3f045a9ce970affcb2a889f44bdefd
2013-10-24 09:44:33 +00:00
Translation updater bot
64f427eb88 Localisation updates from http://translatewiki.net.
Change-Id: Ib6cdd80506e78608d9d8af15088020528fdec256
2013-10-07 21:16:52 +00:00
Translation updater bot
d4018551b0 Localisation updates from http://translatewiki.net.
Change-Id: I4f52889299ffc8ae8d49634fd8b36d73c66d8b5a
2013-09-07 19:47:58 +00:00
Translation updater bot
5f7a37f271 Localisation updates from http://translatewiki.net.
Change-Id: I5e7da5913a10c7f75cdf223f2166cc7873134949
2013-09-04 19:50:47 +00:00
Translation updater bot
a06bf8f56a Localisation updates from http://translatewiki.net.
Change-Id: I811dc8a2b7065867047e4519257b6c611fdc47df
2013-07-29 19:29:49 +00:00
Translation updater bot
882f25af96 Localisation updates from http://translatewiki.net.
Change-Id: I525a26602a3f7d210b1a710cfc4b0d7b67961095
2013-07-28 18:58:08 +00:00
Translation updater bot
5f140a8a57 Localisation updates from http://translatewiki.net.
Change-Id: I8ba898043b74a52eeb01aabfb81af51ef3a0c451
2013-07-25 19:25:15 +00:00
Translation updater bot
09bcad839d Localisation updates from http://translatewiki.net.
Change-Id: Icd89c666b6962cf3028ee4d13860f4f61243c654
2013-07-21 19:04:25 +00:00
Translation updater bot
ebcc25f312 Localisation updates from http://translatewiki.net.
Change-Id: I4e0a77e7c5d398749995401d4035f16ce994ecea
2013-07-20 20:44:43 +00:00
Translation updater bot
e1d1e798b7 Localisation updates from http://translatewiki.net.
Change-Id: Ia8805c66d2f2ee54f84658faed8011ab2d73f1a1
2013-07-18 19:35:47 +00:00
Translation updater bot
cd951c7458 Localisation updates from http://translatewiki.net.
Change-Id: Id0eefc207ad24da4e636fc70351e7c82aaa20d63
2013-07-17 19:25:23 +00:00
Translation updater bot
3ac4f416ce Localisation updates from http://translatewiki.net.
Change-Id: Ic83e47bec279a98ef3be15f5c697f07dda78c4d0
2013-07-14 19:15:22 +00:00
Translation updater bot
d92f4f2549 Localisation updates from http://translatewiki.net.
Change-Id: I1dc387ee8e4166d2a2409cd66dbaaafda98dd35d
2013-07-11 19:06:45 +00:00
Translation updater bot
5ded7d798b Localisation updates from http://translatewiki.net.
Change-Id: Iaeac89a92a8d091d0aa86f726f40ec2ee238068e
2013-07-10 21:28:09 +00:00
Translation updater bot
3154b26868 Localisation updates from http://translatewiki.net.
Change-Id: Ic862c638ed6ce33d3fe4dad9743c88136d832433
2013-05-20 12:08:40 +00:00
Translation updater bot
2182edf481 Localisation updates from http://translatewiki.net.
Change-Id: I36833fa0e34d515906005009fcfe7ffb7f59a3e9
2013-03-17 19:51:22 +00:00
Siebrand Mazeland
553b176525 Localisation updates from http://translatewiki.net.
Updates for special page aliases.

Change-Id: Id1400249980400e0007eea3c5fb3e511aeb22878
2013-01-28 14:50:35 +01:00
Translation updater bot
fae0081553 Localisation updates from http://translatewiki.net.
Change-Id: I48ac66945d3f0b66176c5f19c5b703f0fd14989b
2013-01-17 21:07:31 +00:00
Translation updater bot
5eadf41162 Localisation updates from http://translatewiki.net.
Change-Id: I1832224e316757869dc2071d0f52b9a376ad0a1c
2012-11-27 20:38:14 +00:00
Translation updater bot
6fba0d74c7 Localisation updates from http://translatewiki.net.
Change-Id: Ibb1d15728b75d4faaa21fbcab6393fa55eb0c4b3
2012-11-26 20:21:47 +00:00
Translation updater bot
9eba94318f Localisation updates from http://translatewiki.net.
Change-Id: I31e192158cad615c628471f295d8a1ce5f5d8438
2012-11-24 20:51:41 +00:00
Siebrand Mazeland
9be697fa4e Update parts order in message files
Update the order of parts in messages files. Not done for all files. Order set as:
fallback, encoding, namespace related, special pages, magic words, other (no fixed
ordering after magic words).

Change-Id: Ide5ec747ba62a8c2bca8040a14d0aeea8e6c79b9
2012-10-31 22:51:46 +01:00
Translation updater bot
a736aafbc2 Localisation updates from http://translatewiki.net.
Change-Id: I0bf66cb49b3111d95c4ae3a0d56935fe03065345
2012-10-30 20:21:22 +00:00
Translation updater bot
6c84db2f8c Localisation updates from http://translatewiki.net.
Change-Id: I766bdb2f0fd630144b1bd56f0fa5135af8fbdf5d
2012-10-03 19:34:49 +00:00
Siebrand Mazeland
14d866b702 Localisation updates from http://translatewiki.net.
Updates for magic words.

Change-Id: I7479b0d525385cca4eddafc57e260a90af65a522
2012-08-26 13:55:25 +02:00
Translation updater bot
6bd1df2913 Localisation updates from http://translatewiki.net.
Change-Id: Ia20d132ff4467b41c4d7788411ed2ae4dbc4d1c0
2012-08-20 19:16:15 +00:00
Translation updater bot
a48ba8b4e2 Localisation updates from http://translatewiki.net.
Change-Id: I7f355864088419d9fa96788a2b329c858457f183
2012-08-07 20:06:21 +00:00
Translation updater bot
2bcca9b525 Localisation updates from http://translatewiki.net.
Change-Id: Ib350fbdffc2246830f418a122f3d417b36e07c22
2012-07-01 13:05:28 +00:00