Commit graph

17 commits

Author SHA1 Message Date
jenkins-bot
a94b359376 Merge "Implement LanguageConverter for sh.wiki" 2022-11-24 22:28:46 +00:00
Matěj Suchánek
fedd504fda Hard-deprecate LanguageConverterFactory::isTitleConversionDisabled
It has been deprecated since 1.36 and it is unused.

Change-Id: I9e1761063904aa4e64f992dfaf1b566d778a8fd0
2022-11-20 20:58:58 +01:00
Acamicamacaraca
a573bea01b Implement LanguageConverter for sh.wiki
This patch will implement a one-way transliterator (Latin->Cyrillic), per community consensus.

Bug: T268033
Change-Id: I6f3e7efe3630e9960584dca3a5ee55cb92ea722c
Co-Authored-By: Deni <deni@deni.dk>
Co-Authored-By: Winston Sung <winston21.sung@gmail.com>
2022-11-15 06:29:11 +00:00
Winston Sung
bb228fff7e Split "static default variant" language code from "language code with converter"
for LanguageConverter

"Static default variant" language code won't always be the same of
 "language code with converter" when there's one of the variant form
 specified as the "default variant language" instead of "mixed-form".
We would like to specify "sh-latn" instead of "mixed-script sh" as the
 static default variant language for ShConverter.
The function "getMainCode" was not renamed for compatibility.

Bug: T268033
Change-Id: Ibd0fadf9ba1f740cf4aed06e11138549c9d6dc9f
2022-11-15 04:48:53 +00:00
Winston Sung
26fc3fdba8 Split "main variant language code" from "language code with converter"
for LanguageConverterFactoryTest.php

"Main variant language code" won't always be the same of "language code
 with converter" when there's "specified default variant language".

Bug: T268033
Change-Id: I718dd1b787d762d5a595417889fd3306ac8ce504
2022-11-09 03:00:42 +00:00
Winston Sung
bbde1f3b88 Update LanguageConverter ShiConverter shi/"unconverted" variant
Bug: T278639
Change-Id: Ibc869cf17a76a0e81667f48c8d66b7a44e27e4bc
2022-08-26 07:41:43 +00:00
Umherirrender
a9bc9f8a04 Use ObjectFactory in LanguageConverterFactory
Use the object factory to inject service into TrivialLanguageConverter
class.
The other language converter classes does not use service directly.
The classes are using indirectly services in some function of
the parent class, which needs injection as well (tracked with T294185).

Needs fallback to global state in TrivialLanguageConverter, because the
class is used in extensions integration tests

Change-Id: If72d054d062a4f357e12c5b168e118bfafffd626
2022-02-24 17:47:09 +01:00
Amir Aharoni
14d363c29f Add converter for the Talysh language (tly)
Mostly copied from UzConverter.

This is a very simple converter, with bidirectional one to one
correspondence: for every Latin letter there is a corresponding
Cyrillic letter and vice versa. There are no digraphs or punctuation
to convert.

The Latin alphabet is the primary one used for this language today,
and will probably remain so for the foreseeable future, so "tly" remains
the usual code, and "tly-cyrl" is added for Cyrillic.

Language name is changed:
* The main language name is now Latin.
* The word "language" ("зывон") is removed.
* The spelling of the word "Talysh" is based on the Pireyko dictionary.

Bug: T258975
Change-Id: I552e07967ea82e03c413a0b10b129a846aa007c7
2021-02-17 13:49:36 +00:00
Umherirrender
a1de8b8700 Tests: Mark more more closures as static
Result of a new sniff I25a17fb22b6b669e817317a0f45051ae9c608208

Bug: T274036
Change-Id: I695873737167a75f0d94901fa40383a33984ca55
2021-02-09 02:55:57 +00:00
Peter Ovchyn
d8f54cae8b Language: Turn public properties into Getters in LanguageConverter based hierarchy
The main goal is to simplify the construction of the LanguageConverter and
avoid using constructors for derived classes.

In order to hard-deprecate removed property, DeprecationHelper::deprecatePublicPropertyFallback
was introduced.

Bug: T253834
Change-Id: Ib167982e4e872cfdf0fbcb78b7ca597f5ac8d60a
2021-02-03 15:17:42 +02:00
DannyS712
8dbcddb333 LanguageConverterFactoryTest::codeProvider simplify using a loop
Change-Id: I06adfcd43ef846124742d901e15c98e92bfc9bd1
2021-01-14 08:43:02 +00:00
David Kamholz
9cb5187944 Implement Balinese language converter
This patch implements the BanConverter class for Balinese. Its purpose is to transliterate Balinese in Balinese script to Latin script. Latin to Balinese is not currently supported, because (1) the Latin transliteration is not fully one-to-one, (2) I'm not aware of any users who currently need Latin to Balinese.

The converter supports three distinct Latin transliteration variants: ban-dharma, ban-palmleaf, and ban-puri-kauhan-ubud. All three variants have been requested by different Balinese community members working with Balinese palm-leaf manuscripts. ban-puri-kauhan-ubud is the default, as it is the most familiar to lontar scholars, but Balinese Wikisource users will be able to select their preferred variant via a user script.

Conversion is accomplished via ICU Rule-Based Transliterators, bindings for which are available through the Intl extension.

This patchset adds the abstract class LanguageConverterIcu and has BanConverter inherit from it (makes future ICU-based LanguageConverters easier).

Bug: T263082
Change-Id: Ic3a46a215fbf020a022726e6b130b1d25496e284
2020-12-21 12:45:41 -08:00
C. Scott Ananian
c64e71615e Replace $wgDisable{Lang,Title}Conversion with LanguageConverterFactory methods
Replace direct access to $wgDisableLangConversion with
LanguageConverterFactory::isConversionDisabled(), and replace direct
access to $wgDisableTitleConversion with
LanguageConverterFactory::isTitleConversionDisabled().  However, most
places that check ::isTitleConversionDisabled() actually want
::isLinkConversionDisabled(), so add that too (and deprecate
isTitleConversionDisabled()).

Code search:
https://codesearch.wmcloud.org/search/?q=Disable%28Lang|Title%29Conversion&i=nope&files=&repos=

This change removes a number of spurious dependencies on the global
configuration and reduces code duplication (for example, if the logic
for disabling language conversion were ever to change).

Depends-On: I6fa8230ae97b0e34c381003548e61f9b7387d363
Change-Id: Icc4687638ff1815003dd903854efdbd904854f1e
2020-11-25 12:47:26 -05:00
DannyS712
25a90e8009 Remove unneeded ::setUp and ::tearDown methods that only call parent
Change-Id: I2a12859cfc56059bb71afa2aac08a8f86e746612
2020-06-07 10:09:32 +00:00
Aaron Schulz
1238043eff Add MediaWikiIntegrationTestCase::assertArraySubmapSame()
Also fix PHPUnit 9 warning in PNGMetadataExtractorTest about $delta.

This should fix all of the integration test warning spam.

Bug: T244095
Change-Id: I0e2a76d5df2685ae5ad1498864e0b5f9db60c0cc
2020-03-19 15:53:59 -07:00
Peter Ovchyn
baa0e2a425 languages: Decrease visibility of public variables in LanguageConverter class
Bug: T243461
Change-Id: I461ce7daba3a6a85464a69f4de76b1740472702d
2020-02-04 16:53:15 +02:00
Peter Ovchyn
61e0908fa2 languages: Introduce LanguageConverterFactory
Done:
* Replace LanguageConverter::newConverter by LanguageConverterFactory::getLanguageConverter
* Remove LanguageConverter::newConverter from all subclasses
* Add LanguageConverterFactory integration tests which covers all languages by their code.
* Caching of LanguageConverters in factory
* Make all tests running (hope that's would be enough)
* Uncomment  the deprecated functions.
* Rename FakeConverter to TrivialLanguageConverter
* Create ILanguageConverter to have shared ancestor
* Make the LanguageConverter class abstract.
* Create table with mapping between lang code and converter instead of using name convention
* ILanguageConverter @internal
* Clean up code

Change-Id: I0e4d77de0f44e18c19956a1ffd69d30e63cf51bf
Bug: T226833, T243332
2020-02-03 11:38:03 +02:00