The arg order of truncate_endBracket is tag, type, lastCh, tags, but the
type and lastCh are in wrong order. This is only relevant when $tag is
still non-empty after the loop, which is only happen for unclosed html
tags.
Found by phan strict checks
Change-Id: I08d6926dd4aac8ccc86c776f57a26437013ecb1d
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
There is a common and reasonable need for longer lines in tests.
The nudge for shorter lines doesn't seem valuable here. The natural
breaks will likely still fall in 80-100 given the enforced practice
for non-test code, e.g. whether through habit, or 80-100 column markers
in text editors, or the finite width of diff and code review
interfaces.
Change-Id: I879479e13551789a67624ce66f0946d2f185e6ee
Expected value is the first parameter to assertSame() or assertEquals().
And turn to use assertCount() for some assertions aginst count of array.
Based on code search `assert(?:Same|Equals)\(.+,.+expected` and I look
through files roughly, so some assertions that don't contains 'expected'
are also fixed. In the meantime, some assertions that I am not clear
about are not touched.
Change-Id: I75798b60d29fd19b33f4fdf34ed3c788db420d01
They were added in
Idca1bfc9f4eff7dc561253424f15c15ea007ab6d
See also bug T49211.
However, it looks like they are not actually used anywhere
except one test.
Change-Id: Id409e799f172bb6a76e9ba248cd2f4921696398b
Code of some language's parent language can't simply strip out the subcode.
e.g. ike-cans should get iu.
Change-Id: I4cf5bb1ddc463a8d98064451dd8e4dbebeca96e9
LanguageIntegrationTest asserts strict equality for namespaces, but
other extensions which add to namespaces are not accounted for. This
seems to work OK when LanguageIntegrationTest is run alongside all other
PHPUnit tests but causes failures when run on its own (see console
output in T297078).
Asserting the submap should be sufficient for this test, AIUI.
Bug: T297079
Change-Id: I708c79f452a3eede1bae1422f27160a32db0e4dd
* Added ParamType::OBJECT, which allows Stringable objects to be passed into MessageValue
Bug: T278482
Change-Id: Ib4990f87d4ad70b7525d7aa05c8b97e90c121674
Depending on which namespace we want these classes to have after
T166010 they could either stay in includes/languages/ (plural) in
their own MediaWiki\Languages\-namespace dedicated to Language
subclasses, or they could go in into a subdirectory like
`includes/language/languages/` if we want to keep them in the same
top-level namespace as other Language classes and services, but in
a more nested namespace.
For now, I've made the smaller change and kept the Language subclasses
in their own directory directly under includes/, not nested further.
Bug: T225756
Change-Id: I01015424707b442853879fd50c97f00215e5c2fa
Use RequestContext::getMain()->getUser() instead.
Given that there is an explicit check if the user is safe
to load, this should be fine - if the RequestContext
doesn't already have a user, it'll create one via
User::newFromSession() and then the isSafeToLoad()
call will fail.
Bug: T243708
Change-Id: I06906681e1c1e9ea3ef3c6e4fddcea7871bf164f
The existing system messages
* size-zetabytes
* size-zetapixel
* bitrate-zetabits
are kept for compability and are now deprecated.
Bug: T283958
Change-Id: I9460e3b8c2655e9e68ce9147076f4bb1da02237f
… including PHPDoc tags like `@return <type> $variableName`.
A return value doesn't have a variable name. I can see that
some people do this intentionally, repeating the variable
name that was used in the final `return $var;` at the end
of a method. This can indeed be helpful. I leave a lot of
these untouched and removed them only when it's obviously
wrong, or does not provide any additional information in
addition to what the code already says.
Change-Id: Ia18cd9f25ef658b08ad25b97a744897e2a8deffc
Ended up using
grep -Prl '\->setMethods\(' . | xargs sed -r -i 's/setMethods\(/onlyMethods\(/g'
special-casing setMethods( null ) -> onlyMethods( [] )
and then manual fix of failing test (from PS2 onwards).
Bug: T278010
Change-Id: I012dca7ae774bb430c1c44d50991ba0b633353f1
The following methods and fields in the Language class, deprecated since
1.35, have been removed:
- findVariantLink()
- convertTitle()
- updateConversionTable()
- classFromCode()
- clearCaches()
- mConverter
Change-Id: I9281f37be3a374e072d6afde8f352138af13adbe
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
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
Autofix in codesniffer was wrong, see T273624
Follow-up: Idb413be4b8cba8611afdc022af59810ce1a4531e
Change-Id: I97c174661ba9ed3e8da7f6b164666d53f36e9fa3
LanguageConverterIntegrationTest was added. It checks work of each converter with providing of long texts to translate. It must check each converter(includes/language/converters) as much as possible.
Bug: T272164
Change-Id: I4504b8071c4ae0427375a6c1acffd62d4e6121b5
The alphabets are based on what is used in
"Dictionnaire Général de la Langue Amazighe Informatisé"
by IRCAM (https://tal.ircam.ma/dglai/lexieam.php, DGLAi).
This was also requested by the community in the Tashelhit
Wikipedia Incubator.
Changes:
* Tests are enhanced to cover the whole alphabet.
* The Latin letter š is replaced with the letter c as
the equivalent of Tifinagh letter ⵛ.
* The Tifinagh letters ⵠ and ⵒ are eliminated
because they are not used in the Moroccan version
of Tifinagh, as presented in the DGLAi.
* The Latin letters O, P, V are converted to the
Tifinagh letters ⵓ, ⴱ, ⴼ, which are the same letters
that correspond to the Latin letters U, B, and F.
* Greek Gamma and Epsilon characters are replaced with
the corresponding characters from the Latin range.
* All the non-ASCII Latin letters are added to
the uppercase-lowercase Latin conversion.
This is the first patch in a series to fix the most important
issues listed above. It's kept minimal to make reviewing easier.
There will be more patches to fix readability and public/private
members, and to add more tests.
Change-Id: I7134216457b12018fd187ca7200e45c1b5a67471
* parent::setUp() should be first, and ::tearDown()
should be last
* Move tests that directly extend PHPUnit\Framework\TestCase
to /unit
Change-Id: I1172855c58f4f52a8f624e6d596ec43beb8c93ff
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
Some User methods fail if they are called before $wgRequest is
set. But according to the Setup.php comment, it is only set for b/c.
The global request object can be lazy-initialised at any time.
This is sufficient to avoid T263911 (loss/obfuscation of the $wgServer
error message).
In tests, try to keep $wgRequest and RequestContext::$request in sync.
Introduce MediaWikiIntegrationTestCase::setRequest() which sets both at
once, and use that instead of setMwGlobals() or direct assignment.
BlockManagerTest was accidentally exploiting the fact that the global
context request and $wgRequest were separate objects. Making them the
same causes session cookies to appear in the response, breaking the
cookie counts. Use a new response for the test.
Bug: T263911
Bug: T245940
Change-Id: I2be99f7251a837bc6b62be0b152038157dec10f2
Should be a no-op, doesn't actually reduce the places where $wgUser
is set, just reduces the number of hits in codesearch and makes the
future migration of LanguageConverter to not use $wgUser a bit
easier
Bug: T243708
Change-Id: Ieb04b0e760dd37e037a95408ef429ac5c510f1d9
This trait is used in class LanguageIntegrationTest, resulting in the
language code "integration" being used, which is an invalid language.
Change-Id: I9398015bb0e85eb26116bb8608c8f39216ce8204