Commit Graph

37 Commits

Author SHA1 Message Date
Fomafix
e44e4c4c0c Remove phpcs exclude rules and update PHP code
Change-Id: Ie37deda368a4d163cf324988721033829ae8af77
2022-11-13 18:33:34 +00:00
Niklas Laxström
4afaa67bea LanguageNameIndexer: Declare extension dependencies
Change-Id: I052f2600902234cfba42c7e7226fc5dcf0c7e2d4
2022-07-26 15:15:53 +03:00
Reedy
80444e8be6 Fix indenting of LanguageNameSearchData.php
Bug: T296506
Change-Id: I6f6cfb53abeb42d75e876d9e2d481291265f0466
2021-11-25 23:40:02 +00:00
Niklas Laxström
c79e0292aa LanguageNameIndexer: Small cleanups
Change-Id: I24509b35c403dcdae94f921ccc9b82c2e9c78aa7
2021-04-21 11:48:16 +00:00
Niklas Laxström
97dffe3a9b Quick fix for LanguageNameIndexer
A better fix would be to use JSON directly from language-data.

Bug: T279971
Change-Id: Iaaf936c4ba46069df2a4855056e613d62f8d7118
2021-04-21 11:00:47 +00:00
Umherirrender
44175839e5 Handle invalid value from LanguageNameIndexer::getLanguageData
Check preg_match return for failure and also check json_decode for
failure by checking for the index key needed for further processing.

Change-Id: Ifecf3fdaf476a05d0dc6fc1c40c3d8a2aa0fa88b
2020-06-02 20:28:25 +00:00
Niklas Laxström
6939354e16 Update language name search index
I noticed some language names are not searchable. I made it so
that autonyms from language-data are added to the search index.
Without this, languages not present in Names.php or in the CLDR
extension are not searchable via the API except by language code.

Change-Id: I51a9e2eb15fb40963e6edbf1db76133d84de7291
2019-05-21 17:21:21 +02:00
Umherirrender
fbf3f3b214 build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
MLEB extensions now supporting php7

Change-Id: I582418eb4038114d0e751797bc17929ca4633867
2019-03-11 22:36:40 +01:00
Umherirrender
03bc19fab2 Use ::class for class name resolution
Available since php5.5

Change-Id: Ie71b7f9d289a34532f6e3e1f32ac25bf08b9903f
2019-03-02 20:11:12 +01:00
Kunal Mehta
10a5865f9a Fix MediaWiki.Commenting.LicenseComment.InvalidLicenseTag errors
Change-Id: I2c868006d108b35adaa19d179bc6ebe95e29d0ef
2018-05-23 23:02:54 -07:00
libraryupgrader
f97802e4e2 build: Updating mediawiki/mediawiki-codesniffer to 18.0.0
The following sniffs are failing and were disabled:
* MediaWiki.VariableAnalysis.UnusedGlobalVariables.UnusedGlobal$wgWBClientSettings

Change-Id: Ia5423c3d7ea419b3f073f35736de7a9379d4429a
2018-04-14 07:39:31 +00:00
libraryupgrader
858ebd5552 build: Updating mediawiki/mediawiki-codesniffer to 17.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.LicenseComment.InvalidLicenseTag

The following sniffs now pass and were enabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment

Change-Id: I06e0542d737cec5e2500aad6d85f72951f8b584d
2018-03-29 06:53:52 +00:00
Niklas Laxström
1e15341fd1 Use dash as separator for non-prefix matches in language name search
Bug: T186480
Change-Id: Ib785e2b070e0c5a218b236be194417f0b1fbd102
2018-02-06 17:26:21 +01:00
Vagrant Default User
91a54767b6 Add aliases for Georgian, Armenian, Spanish, and Japanese
Also make it possible to add multiple aliases for a language.

Bug: T178996
Change-Id: I00bb4a158caed0c1ba15d41e294281a001c917b1
2018-01-18 14:45:26 +02:00
Niklas Laxström
e87dd20cdd Improve ULS language search api
* Store prefixes and infixes separately in the data
* First match language code, then prefixes, then infixes
* Try to use suggestion either in user language or autonym first
* use formatversion=2 to avoid escaping Unicode

Using Language::fetchLanguageName might can have a small
performance impact. On the other hand there is now check
to skip languages we already found, avoiding some fuzzy
matching.

This is in a preparation for a change in jquery.uls to use
the search API more, while trying to reduce the amount of
weird autocompletion suggestions we show to the user.

Bug: T73891
Change-Id: Id94c5352d9a591969bf90144d1d2d5e758d08301
2017-11-27 14:57:42 +01:00
Niklas Laxström
a353c5ab65 Perform search on every word of language name
See e.g. T132021. This favours coverage over quality.

Change-Id: I3fc8fb1702802bc002c3d7e2941563840914f325
2017-11-23 09:14:10 +00:00
Niklas Laxström
56d3f2af43 Make output of LanguageNameIndexer more consistent
Change-Id: I13f06b9b1c65068206f1728f8a427c4ca46f28ec
2017-10-31 16:25:01 +01:00
Amire80
101532cfa6 Add special language names to facilitate searching
This adds several custom languages.

The addition of Punjabi addresses Bug T178070.

The addition of Chinese addresses Bug T73891.

Georgian and Catalan (Valencian) variant spellings
are added because these are the most frequent languages
that are not found in the ULS search box.

Bug: T73891
Bug: T178070
Change-Id: Ifbb08b560e454643d246379c19f725bde61917e9
2017-10-25 13:50:12 +05:30
Niklas Laxström
f73f9a8b5d LanguageNameIndexer: print bucket stats
Change-Id: If50b65b1bbda010f0dbde7d344edcb5bdcd382df
2016-08-08 13:38:53 +00:00
Niklas Laxström
bc7ee1ed19 LanguageNameIndexer: sort buckets
Change-Id: Ib33bc432d5f61de2fbb6e83f3566baebb184c441
2016-08-08 13:18:30 +00:00
Niklas Laxström
42f4f9650b LanguageNameIndexer: Remove directionality chars that cannot be typed
Change-Id: I8e5b9f300a3307a90054e4e759279f91594a2fa3
2016-08-08 10:56:39 +00:00
Niklas Laxström
b3ba423354 LanguageNameIndexer: Generate PHP file instead of serialized file.
Serialized format is no longer in style for data. PHP files can
take advantage of AutoLoader and caching so they can even be faster
than serialized files. As side bonus we can have readable diffs
for updates.

Only downside is that the file generation takes about ten lines of
ugly string manipulation.

Change-Id: If09704d1172daa13c72a308814534cac1fe9899f
2016-08-08 07:55:42 +00:00
Niklas Laxström
9daeacf1c5 LanguageNameIndexer/Search: use unicode aware lowercasing
With this MEÄNKELI with typos=1 finds results.

Updated test case for lowercased result. Renamed variables in test
file for clarity. Updated the default value for MW_INSTALL_PATH to
work with the default layout.

Change-Id: Id93c84d308705f55b4d2378fc8c7b7f243e1b53f
2016-08-08 08:43:15 +02:00
Niklas Laxström
920155fb18 LanguageNameIndexer: Simplify code
Inline one loop and remove autonym handling since getting the
translation of a language name in its own language gives the
autonym.

Change-Id: I0c8ff8e3ce0c7f23d123656b091df37aa71b2cd7
2016-06-15 11:22:02 +02:00
Niklas Laxström
c37be51fa0 LanguageNameIndexer: Rename variables to make this code more understandable
Change-Id: Ib328bf49b46b222b04fcfe60359baff2fbbc3a7f
2016-06-15 11:21:34 +02:00
Kunal Mehta
6b8c33e763 build: Updating mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I6f3f29f03abb607fbca9cec6f140875f2a3468a0
2016-05-09 18:30:34 -07:00
Siebrand Mazeland
f8487a54eb Use single quotes where possible
Change-Id: I8c0098e4840d7eff16cf5818f2247b134946d77b
2016-03-07 07:13:10 +00:00
Niklas Laxström
f3a05e271b Remove not useful comments
Change-Id: I99c30a6c6d6b59e86e5e3efe31f38439c5e95095
2015-08-28 18:24:49 +02:00
Timo Tijhof
c6d71015ff Various clean up
Files:
* Consistently have one (1) new line at EOF
  (.gitignore, *.css, *.sh)

JSHint:
* Separate the common (general Wikimedia code conventions) from
  the local more stricter rules (nice work!).

Maintenance:
* Use simplified $IP definition where getenv is only called once.
  Based on http://git.io/ve-mw-36fc3b59-makeStaticLoader

JavaScript:
* Use the same closure in all files:
  - No need for "undefined".
  - One linebreak between license header and start of closure
    (sometimes there were 1 or 2 empty lines).
  - ext.uls.ime.js: No need for "document" (redundant in general,
    but especially as it wasn't used anywhere in this file).
  - Use "$, mw" for all ext.* modules (one of them used "mw, $").

Change-Id: Iba5dab14bbc3fbfc9f8fe96dd2d95529587a69aa
2014-02-08 00:11:50 -08:00
Niklas Laxström
3a6e5d312a Code conventions
Change-Id: I0f58d4675cf26050ea1e2f58fb748e0aed74b54d
2013-08-20 05:34:16 +00:00
Siebrand Mazeland
7ad76c6b64 Coding style updates
Fix issues pointed out by PHP Code Sniffer.

Change-Id: I31279cda12101bb0ad66f104c9cd0e11019d46f1
2013-06-17 16:48:41 +02:00
Siebrand Mazeland
4a1035dcbf Remove last bits of MediaWiki 1.19 compatibility
Compatibility with MediaWiki 1.19 had already been dropped and this hadn't
been removed yet.

Change-Id: I63788ef1d4a6eb87e4280ea2625579a7874eaff8
2013-06-17 16:44:00 +02:00
Siebrand Mazeland
583ce45a53 Remove unused variable
Change-Id: If8da6e911f98c833817a46ca047a52ac83de44bd
2013-06-17 16:25:12 +02:00
Amir E. Aharoni
c9a5ec7f19 Add backward compatibility for fetchLanguageNames
Bug: 46737
Change-Id: Ife7c2834c2b2c4f2619b4a5d8e0b0aa1db595984
2013-04-30 16:01:47 +03:00
Siebrand Mazeland
7be6eeaa2e Fix possible variable pollution
Change-Id: I93b3329d4ff2d8affac379d10baec892c46481f0
2012-11-12 07:45:12 +01:00
Reedy
0f0732f865 Fixup a few minor documentation issues
Added some newlines

Left a FIXME in LanguageNameIndexer.php

Losslessly compressed display.png

Change-Id: I884b423d3812ddb964a6a70f75a6331a73371165
2012-08-19 01:19:46 +01:00
Santhosh Thottingal
08c14dafa4 Cross-language language name search
Implementation of Also Written As language name
search algorithm.
See http://etherpad.wikimedia.org/l10n-uls-language-search

Change-Id: Iff84408c531b650a44d031b63d5c823737cceafc
2012-07-30 14:08:26 +05:30