Remove module 'jquery.i18n'

Since MediaWiki 1.26 the module 'jquery.i18n' is in core:
 git blame origin/REL1_26 -- resources/Resources.php

Bug: T153635
Change-Id: Ie4cf86dd5020a75456cfe183b26c114437eb22e0
This commit is contained in:
Fomafix
2016-12-23 20:20:40 +01:00
parent 5f987e7a49
commit 1312b905f2
25 changed files with 2 additions and 2623 deletions

View File

@@ -460,59 +460,13 @@ class UniversalLanguageSelectorHooks {
}
/**
* Conditionally register jquery.18n (backwards copatbility for those on pre-MediaWiki 1.26).
* Conditionally register module ext.uls.eventlogger.
*
* @param ResourceLoader $resourceLoader
* @return boolean true
*/
public static function onResourceLoaderRegisterModules( ResourceLoader $resourceLoader ) {
global $wgResourceModules, $wgULSEventLogging;
if (
(
(
is_callable( [ $resourceLoader, 'isModuleRegistered' ] ) &&
!$resourceLoader->isModuleRegistered( 'jquery.i18n' )
)
||
$resourceLoader->getModule( 'jquery.i18n' ) === null
)
&&
!isset( $wgResourceModules[ 'jquery.i18n' ] )
) {
$resourceLoader->register( [
'jquery.i18n' => [
'scripts' => [
'lib/jquery.i18n/jquery.i18n.js',
'lib/jquery.i18n/jquery.i18n.messagestore.js',
'lib/jquery.i18n/jquery.i18n.parser.js',
'lib/jquery.i18n/jquery.i18n.emitter.js',
'lib/jquery.i18n/jquery.i18n.emitter.bidi.js',
'lib/jquery.i18n/jquery.i18n.language.js',
],
'dependencies' => 'mediawiki.libs.pluralruleparser',
'languageScripts' => [
'bs' => 'lib/jquery.i18n/languages/bs.js',
'dsb' => 'lib/jquery.i18n/languages/dsb.js',
'fi' => 'lib/jquery.i18n/languages/fi.js',
'ga' => 'lib/jquery.i18n/languages/ga.js',
'he' => 'lib/jquery.i18n/languages/he.js',
'hsb' => 'lib/jquery.i18n/languages/hsb.js',
'hu' => 'lib/jquery.i18n/languages/hu.js',
'hy' => 'lib/jquery.i18n/languages/hy.js',
'la' => 'lib/jquery.i18n/languages/la.js',
'ml' => 'lib/jquery.i18n/languages/ml.js',
'os' => 'lib/jquery.i18n/languages/os.js',
'ru' => 'lib/jquery.i18n/languages/ru.js',
'sl' => 'lib/jquery.i18n/languages/sl.js',
'uk' => 'lib/jquery.i18n/languages/uk.js',
],
'targets' => [ 'desktop', 'mobile' ],
'localBasePath' => __DIR__,
'remoteExtPath' => 'UniversalLanguageSelector',
]
] );
}
global $wgULSEventLogging;
if ( $wgULSEventLogging ) {
$resourceLoader->register( [

View File

@@ -1,9 +0,0 @@
Credits
=======
Santhosh Thottingal
Amir E. Aharoni
Siebrand Mazeland
Niklas Laxström
Neil Kandalgaonkar
David Chan

View File

@@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -1,21 +0,0 @@
Copyright (c) 2012-2013 Santhosh Thottingal and other
contributors. See CREDITS for a list.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because one or more lines are too long

View File

@@ -1,168 +0,0 @@
/*!
* jQuery Internationalization library
*
* Copyright (C) 2011-2013 Santhosh Thottingal, Neil Kandalgaonkar
*
* jquery.i18n is dual licensed GPLv2 or later and MIT. You don't have to do
* anything special to choose one license or the other and you don't have to
* notify anyone which license you are using. You are free to use
* UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
( function ( $ ) {
'use strict';
var MessageParserEmitter = function () {
this.language = $.i18n.languages[ String.locale ] || $.i18n.languages[ 'default' ];
};
MessageParserEmitter.prototype = {
constructor: MessageParserEmitter,
/**
* (We put this method definition here, and not in prototype, to make
* sure it's not overwritten by any magic.) Walk entire node structure,
* applying replacements and template functions when appropriate
*
* @param {Mixed} node abstract syntax tree (top node or subnode)
* @param {Array} replacements for $1, $2, ... $n
* @return {Mixed} single-string node or array of nodes suitable for
* jQuery appending.
*/
emit: function ( node, replacements ) {
var ret, subnodes, operation,
messageParserEmitter = this;
switch ( typeof node ) {
case 'string':
case 'number':
ret = node;
break;
case 'object':
// node is an array of nodes
subnodes = $.map( node.slice( 1 ), function ( n ) {
return messageParserEmitter.emit( n, replacements );
} );
operation = node[ 0 ].toLowerCase();
if ( typeof messageParserEmitter[ operation ] === 'function' ) {
ret = messageParserEmitter[ operation ]( subnodes, replacements );
} else {
throw new Error( 'unknown operation "' + operation + '"' );
}
break;
case 'undefined':
// Parsing the empty string (as an entire expression, or as a
// paramExpression in a template) results in undefined
// Perhaps a more clever parser can detect this, and return the
// empty string? Or is that useful information?
// The logical thing is probably to return the empty string here
// when we encounter undefined.
ret = '';
break;
default:
throw new Error( 'unexpected type in AST: ' + typeof node );
}
return ret;
},
/**
* Parsing has been applied depth-first we can assume that all nodes
* here are single nodes Must return a single node to parents -- a
* jQuery with synthetic span However, unwrap any other synthetic spans
* in our children and pass them upwards
*
* @param {Array} nodes Mixed, some single nodes, some arrays of nodes.
* @return {string}
*/
concat: function ( nodes ) {
var result = '';
$.each( nodes, function ( i, node ) {
// strings, integers, anything else
result += node;
} );
return result;
},
/**
* Return escaped replacement of correct index, or string if
* unavailable. Note that we expect the parsed parameter to be
* zero-based. i.e. $1 should have become [ 0 ]. if the specified
* parameter is not found return the same string (e.g. "$99" ->
* parameter 98 -> not found -> return "$99" ) TODO throw error if
* nodes.length > 1 ?
*
* @param {Array} nodes One element, integer, n >= 0
* @param {Array} replacements for $1, $2, ... $n
* @return {string} replacement
*/
replace: function ( nodes, replacements ) {
var index = parseInt( nodes[ 0 ], 10 );
if ( index < replacements.length ) {
// replacement is not a string, don't touch!
return replacements[ index ];
} else {
// index not found, fallback to displaying variable
return '$' + ( index + 1 );
}
},
/**
* Transform parsed structure into pluralization n.b. The first node may
* be a non-integer (for instance, a string representing an Arabic
* number). So convert it back with the current language's
* convertNumber.
*
* @param {Array} nodes List [ {String|Number}, {String}, {String} ... ]
* @return {string} selected pluralized form according to current
* language.
*/
plural: function ( nodes ) {
var count = parseFloat( this.language.convertNumber( nodes[ 0 ], 10 ) ),
forms = nodes.slice( 1 );
return forms.length ? this.language.convertPlural( count, forms ) : '';
},
/**
* Transform parsed structure into gender Usage
* {{gender:gender|masculine|feminine|neutral}}.
*
* @param {Array} nodes List [ {String}, {String}, {String} , {String} ]
* @return {string} selected gender form according to current language
*/
gender: function ( nodes ) {
var gender = nodes[ 0 ],
forms = nodes.slice( 1 );
return this.language.gender( gender, forms );
},
/**
* Transform parsed structure into grammar conversion. Invoked by
* putting {{grammar:form|word}} in a message
*
* @param {Array} nodes List [{Grammar case eg: genitive}, {String word}]
* @return {string} selected grammatical form according to current
* language.
*/
grammar: function ( nodes ) {
var form = nodes[ 0 ],
word = nodes[ 1 ];
return word && form && this.language.convertGrammar( word, form );
}
};
$.extend( $.i18n.parser.emitter, new MessageParserEmitter() );
}( jQuery ) );

View File

@@ -1,186 +0,0 @@
/*!
* jQuery Internationalization library
*
* Copyright (C) 2012 Santhosh Thottingal
*
* jquery.i18n is dual licensed GPLv2 or later and MIT. You don't have to do anything special to
* choose one license or the other and you don't have to notify anyone which license you are using.
* You are free to use UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
( function ( $, undefined ) {
'use strict';
$.i18n = $.i18n || {};
$.extend( $.i18n.fallbacks, {
ab: [ 'ru' ],
ace: [ 'id' ],
aln: [ 'sq' ],
// Not so standard - als is supposed to be Tosk Albanian,
// but in Wikipedia it's used for a Germanic language.
als: [ 'gsw', 'de' ],
an: [ 'es' ],
anp: [ 'hi' ],
arn: [ 'es' ],
arz: [ 'ar' ],
av: [ 'ru' ],
ay: [ 'es' ],
ba: [ 'ru' ],
bar: [ 'de' ],
'bat-smg': [ 'sgs', 'lt' ],
bcc: [ 'fa' ],
'be-x-old': [ 'be-tarask' ],
bh: [ 'bho' ],
bjn: [ 'id' ],
bm: [ 'fr' ],
bpy: [ 'bn' ],
bqi: [ 'fa' ],
bug: [ 'id' ],
'cbk-zam': [ 'es' ],
ce: [ 'ru' ],
crh: [ 'crh-latn' ],
'crh-cyrl': [ 'ru' ],
csb: [ 'pl' ],
cv: [ 'ru' ],
'de-at': [ 'de' ],
'de-ch': [ 'de' ],
'de-formal': [ 'de' ],
dsb: [ 'de' ],
dtp: [ 'ms' ],
egl: [ 'it' ],
eml: [ 'it' ],
ff: [ 'fr' ],
fit: [ 'fi' ],
'fiu-vro': [ 'vro', 'et' ],
frc: [ 'fr' ],
frp: [ 'fr' ],
frr: [ 'de' ],
fur: [ 'it' ],
gag: [ 'tr' ],
gan: [ 'gan-hant', 'zh-hant', 'zh-hans' ],
'gan-hans': [ 'zh-hans' ],
'gan-hant': [ 'zh-hant', 'zh-hans' ],
gl: [ 'pt' ],
glk: [ 'fa' ],
gn: [ 'es' ],
gsw: [ 'de' ],
hif: [ 'hif-latn' ],
hsb: [ 'de' ],
ht: [ 'fr' ],
ii: [ 'zh-cn', 'zh-hans' ],
inh: [ 'ru' ],
iu: [ 'ike-cans' ],
jut: [ 'da' ],
jv: [ 'id' ],
kaa: [ 'kk-latn', 'kk-cyrl' ],
kbd: [ 'kbd-cyrl' ],
khw: [ 'ur' ],
kiu: [ 'tr' ],
kk: [ 'kk-cyrl' ],
'kk-arab': [ 'kk-cyrl' ],
'kk-latn': [ 'kk-cyrl' ],
'kk-cn': [ 'kk-arab', 'kk-cyrl' ],
'kk-kz': [ 'kk-cyrl' ],
'kk-tr': [ 'kk-latn', 'kk-cyrl' ],
kl: [ 'da' ],
'ko-kp': [ 'ko' ],
koi: [ 'ru' ],
krc: [ 'ru' ],
ks: [ 'ks-arab' ],
ksh: [ 'de' ],
ku: [ 'ku-latn' ],
'ku-arab': [ 'ckb' ],
kv: [ 'ru' ],
lad: [ 'es' ],
lb: [ 'de' ],
lbe: [ 'ru' ],
lez: [ 'ru' ],
li: [ 'nl' ],
lij: [ 'it' ],
liv: [ 'et' ],
lmo: [ 'it' ],
ln: [ 'fr' ],
ltg: [ 'lv' ],
lzz: [ 'tr' ],
mai: [ 'hi' ],
'map-bms': [ 'jv', 'id' ],
mg: [ 'fr' ],
mhr: [ 'ru' ],
min: [ 'id' ],
mo: [ 'ro' ],
mrj: [ 'ru' ],
mwl: [ 'pt' ],
myv: [ 'ru' ],
mzn: [ 'fa' ],
nah: [ 'es' ],
nap: [ 'it' ],
nds: [ 'de' ],
'nds-nl': [ 'nl' ],
'nl-informal': [ 'nl' ],
no: [ 'nb' ],
os: [ 'ru' ],
pcd: [ 'fr' ],
pdc: [ 'de' ],
pdt: [ 'de' ],
pfl: [ 'de' ],
pms: [ 'it' ],
pt: [ 'pt-br' ],
'pt-br': [ 'pt' ],
qu: [ 'es' ],
qug: [ 'qu', 'es' ],
rgn: [ 'it' ],
rmy: [ 'ro' ],
'roa-rup': [ 'rup' ],
rue: [ 'uk', 'ru' ],
ruq: [ 'ruq-latn', 'ro' ],
'ruq-cyrl': [ 'mk' ],
'ruq-latn': [ 'ro' ],
sa: [ 'hi' ],
sah: [ 'ru' ],
scn: [ 'it' ],
sg: [ 'fr' ],
sgs: [ 'lt' ],
sli: [ 'de' ],
sr: [ 'sr-ec' ],
srn: [ 'nl' ],
stq: [ 'de' ],
su: [ 'id' ],
szl: [ 'pl' ],
tcy: [ 'kn' ],
tg: [ 'tg-cyrl' ],
tt: [ 'tt-cyrl', 'ru' ],
'tt-cyrl': [ 'ru' ],
ty: [ 'fr' ],
udm: [ 'ru' ],
ug: [ 'ug-arab' ],
uk: [ 'ru' ],
vec: [ 'it' ],
vep: [ 'et' ],
vls: [ 'nl' ],
vmf: [ 'de' ],
vot: [ 'fi' ],
vro: [ 'et' ],
wa: [ 'fr' ],
wo: [ 'fr' ],
wuu: [ 'zh-hans' ],
xal: [ 'ru' ],
xmf: [ 'ka' ],
yi: [ 'he' ],
za: [ 'zh-hans' ],
zea: [ 'nl' ],
zh: [ 'zh-hans' ],
'zh-classical': [ 'lzh' ],
'zh-cn': [ 'zh-hans' ],
'zh-hant': [ 'zh-hans' ],
'zh-hk': [ 'zh-hant', 'zh-hans' ],
'zh-min-nan': [ 'nan' ],
'zh-mo': [ 'zh-hk', 'zh-hant', 'zh-hans' ],
'zh-my': [ 'zh-sg', 'zh-hans' ],
'zh-sg': [ 'zh-hans' ],
'zh-tw': [ 'zh-hant', 'zh-hans' ],
'zh-yue': [ 'yue' ]
} );
}( jQuery ) );

View File

@@ -1,300 +0,0 @@
/*!
* jQuery Internationalization library
*
* Copyright (C) 2012 Santhosh Thottingal
*
* jquery.i18n is dual licensed GPLv2 or later and MIT. You don't have to do
* anything special to choose one license or the other and you don't have to
* notify anyone which license you are using. You are free to use
* UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
( function ( $ ) {
'use strict';
var nav, I18N,
slice = Array.prototype.slice;
/**
* @constructor
* @param {Object} options
*/
I18N = function ( options ) {
// Load defaults
this.options = $.extend( {}, I18N.defaults, options );
this.parser = this.options.parser;
this.locale = this.options.locale;
this.messageStore = this.options.messageStore;
this.languages = {};
this.init();
};
I18N.prototype = {
/**
* Initialize by loading locales and setting up
* String.prototype.toLocaleString and String.locale.
*/
init: function () {
var i18n = this;
// Set locale of String environment
String.locale = i18n.locale;
// Override String.localeString method
String.prototype.toLocaleString = function () {
var localeParts, localePartIndex, value, locale, fallbackIndex,
tryingLocale, message;
value = this.valueOf();
locale = i18n.locale;
fallbackIndex = 0;
while ( locale ) {
// Iterate through locales starting at most-specific until
// localization is found. As in fi-Latn-FI, fi-Latn and fi.
localeParts = locale.split( '-' );
localePartIndex = localeParts.length;
do {
tryingLocale = localeParts.slice( 0, localePartIndex ).join( '-' );
message = i18n.messageStore.get( tryingLocale, value );
if ( message ) {
return message;
}
localePartIndex--;
} while ( localePartIndex );
if ( locale === 'en' ) {
break;
}
locale = ( $.i18n.fallbacks[ i18n.locale ] && $.i18n.fallbacks[ i18n.locale ][ fallbackIndex ] ) ||
i18n.options.fallbackLocale;
$.i18n.log( 'Trying fallback locale for ' + i18n.locale + ': ' + locale );
fallbackIndex++;
}
// key not found
return '';
};
},
/*
* Destroy the i18n instance.
*/
destroy: function () {
$.removeData( document, 'i18n' );
},
/**
* General message loading API This can take a URL string for
* the json formatted messages. Example:
* <code>load('path/to/all_localizations.json');</code>
*
* To load a localization file for a locale:
* <code>
* load('path/to/de-messages.json', 'de' );
* </code>
*
* To load a localization file from a directory:
* <code>
* load('path/to/i18n/directory', 'de' );
* </code>
* The above method has the advantage of fallback resolution.
* ie, it will automatically load the fallback locales for de.
* For most usecases, this is the recommended method.
* It is optional to have trailing slash at end.
*
* A data object containing message key- message translation mappings
* can also be passed. Example:
* <code>
* load( { 'hello' : 'Hello' }, optionalLocale );
* </code>
*
* A source map containing key-value pair of languagename and locations
* can also be passed. Example:
* <code>
* load( {
* bn: 'i18n/bn.json',
* he: 'i18n/he.json',
* en: 'i18n/en.json'
* } )
* </code>
*
* If the data argument is null/undefined/false,
* all cached messages for the i18n instance will get reset.
*
* @param {string|Object} source
* @param {string} locale Language tag
* @return {jQuery.Promise}
*/
load: function ( source, locale ) {
var fallbackLocales, locIndex, fallbackLocale, sourceMap = {};
if ( !source && !locale ) {
source = 'i18n/' + $.i18n().locale + '.json';
locale = $.i18n().locale;
}
if ( typeof source === 'string' &&
source.split( '.' ).pop() !== 'json'
) {
// Load specified locale then check for fallbacks when directory is specified in load()
sourceMap[ locale ] = source + '/' + locale + '.json';
fallbackLocales = ( $.i18n.fallbacks[ locale ] || [] )
.concat( this.options.fallbackLocale );
for ( locIndex in fallbackLocales ) {
fallbackLocale = fallbackLocales[ locIndex ];
sourceMap[ fallbackLocale ] = source + '/' + fallbackLocale + '.json';
}
return this.load( sourceMap );
} else {
return this.messageStore.load( source, locale );
}
},
/**
* Does parameter and magic word substitution.
*
* @param {string} key Message key
* @param {Array} parameters Message parameters
* @return {string}
*/
parse: function ( key, parameters ) {
var message = key.toLocaleString();
// FIXME: This changes the state of the I18N object,
// should probably not change the 'this.parser' but just
// pass it to the parser.
this.parser.language = $.i18n.languages[ $.i18n().locale ] || $.i18n.languages[ 'default' ];
if ( message === '' ) {
message = key;
}
return this.parser.parse( message, parameters );
}
};
/**
* Process a message from the $.I18N instance
* for the current document, stored in jQuery.data(document).
*
* @param {string} key Key of the message.
* @param {string} param1 [param...] Variadic list of parameters for {key}.
* @return {string|$.I18N} Parsed message, or if no key was given
* the instance of $.I18N is returned.
*/
$.i18n = function ( key, param1 ) {
var parameters,
i18n = $.data( document, 'i18n' ),
options = typeof key === 'object' && key;
// If the locale option for this call is different then the setup so far,
// update it automatically. This doesn't just change the context for this
// call but for all future call as well.
// If there is no i18n setup yet, don't do this. It will be taken care of
// by the `new I18N` construction below.
// NOTE: It should only change language for this one call.
// Then cache instances of I18N somewhere.
if ( options && options.locale && i18n && i18n.locale !== options.locale ) {
String.locale = i18n.locale = options.locale;
}
if ( !i18n ) {
i18n = new I18N( options );
$.data( document, 'i18n', i18n );
}
if ( typeof key === 'string' ) {
if ( param1 !== undefined ) {
parameters = slice.call( arguments, 1 );
} else {
parameters = [];
}
return i18n.parse( key, parameters );
} else {
// FIXME: remove this feature/bug.
return i18n;
}
};
$.fn.i18n = function () {
var i18n = $.data( document, 'i18n' );
if ( !i18n ) {
i18n = new I18N();
$.data( document, 'i18n', i18n );
}
String.locale = i18n.locale;
return this.each( function () {
var $this = $( this ),
messageKey = $this.data( 'i18n' ),
lBracket, rBracket, type, key;
if ( messageKey ) {
lBracket = messageKey.indexOf( '[' );
rBracket = messageKey.indexOf( ']' );
if ( lBracket !== -1 && rBracket !== -1 && lBracket < rBracket ) {
type = messageKey.slice( lBracket + 1, rBracket );
key = messageKey.slice( rBracket + 1 );
if ( type === 'html' ) {
$this.html( i18n.parse( key ) );
} else {
$this.attr( type, i18n.parse( key ) );
}
} else {
$this.text( i18n.parse( messageKey ) );
}
} else {
$this.find( '[data-i18n]' ).i18n();
}
} );
};
String.locale = String.locale || $( 'html' ).attr( 'lang' );
if ( !String.locale ) {
if ( typeof window.navigator !== undefined ) {
nav = window.navigator;
String.locale = nav.language || nav.userLanguage || '';
} else {
String.locale = '';
}
}
$.i18n.languages = {};
$.i18n.messageStore = $.i18n.messageStore || {};
$.i18n.parser = {
// The default parser only handles variable substitution
parse: function ( message, parameters ) {
return message.replace( /\$(\d+)/g, function ( str, match ) {
var index = parseInt( match, 10 ) - 1;
return parameters[ index ] !== undefined ? parameters[ index ] : '$' + match;
} );
},
emitter: {}
};
$.i18n.fallbacks = {};
$.i18n.debug = false;
$.i18n.log = function ( /* arguments */ ) {
if ( window.console && $.i18n.debug ) {
window.console.log.apply( window.console, arguments );
}
};
/* Static members */
I18N.defaults = {
locale: String.locale,
fallbackLocale: 'en',
parser: $.i18n.parser,
messageStore: $.i18n.messageStore
};
// Expose constructor
$.i18n.constructor = I18N;
}( jQuery ) );

View File

@@ -1,473 +0,0 @@
/*global pluralRuleParser */
( function ( $ ) {
'use strict';
var language = {
// CLDR plural rules generated using
// libs/CLDRPluralRuleParser/tools/PluralXML2JSON.html
pluralRules: {
ak: {
one: 'n = 0..1'
},
am: {
one: 'i = 0 or n = 1'
},
ar: {
zero: 'n = 0',
one: 'n = 1',
two: 'n = 2',
few: 'n % 100 = 3..10',
many: 'n % 100 = 11..99'
},
be: {
one: 'n % 10 = 1 and n % 100 != 11',
few: 'n % 10 = 2..4 and n % 100 != 12..14',
many: 'n % 10 = 0 or n % 10 = 5..9 or n % 100 = 11..14'
},
bh: {
one: 'n = 0..1'
},
bn: {
one: 'i = 0 or n = 1'
},
br: {
one: 'n % 10 = 1 and n % 100 != 11,71,91',
two: 'n % 10 = 2 and n % 100 != 12,72,92',
few: 'n % 10 = 3..4,9 and n % 100 != 10..19,70..79,90..99',
many: 'n != 0 and n % 1000000 = 0'
},
bs: {
one: 'v = 0 and i % 10 = 1 and i % 100 != 11 or f % 10 = 1 and f % 100 != 11',
few: 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14'
},
cs: {
one: 'i = 1 and v = 0',
few: 'i = 2..4 and v = 0',
many: 'v != 0'
},
cy: {
zero: 'n = 0',
one: 'n = 1',
two: 'n = 2',
few: 'n = 3',
many: 'n = 6'
},
da: {
one: 'n = 1 or t != 0 and i = 0,1'
},
fa: {
one: 'i = 0 or n = 1'
},
ff: {
one: 'i = 0,1'
},
fil: {
one: 'i = 0..1 and v = 0'
},
fr: {
one: 'i = 0,1'
},
ga: {
one: 'n = 1',
two: 'n = 2',
few: 'n = 3..6',
many: 'n = 7..10'
},
gd: {
one: 'n = 1,11',
two: 'n = 2,12',
few: 'n = 3..10,13..19'
},
gu: {
one: 'i = 0 or n = 1'
},
guw: {
one: 'n = 0..1'
},
gv: {
one: 'n % 10 = 1',
two: 'n % 10 = 2',
few: 'n % 100 = 0,20,40,60'
},
he: {
one: 'i = 1 and v = 0',
two: 'i = 2 and v = 0',
many: 'v = 0 and n != 0..10 and n % 10 = 0'
},
hi: {
one: 'i = 0 or n = 1'
},
hr: {
one: 'v = 0 and i % 10 = 1 and i % 100 != 11 or f % 10 = 1 and f % 100 != 11',
few: 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14'
},
hy: {
one: 'i = 0,1'
},
is: {
one: 't = 0 and i % 10 = 1 and i % 100 != 11 or t != 0'
},
iu: {
one: 'n = 1',
two: 'n = 2'
},
iw: {
one: 'i = 1 and v = 0',
two: 'i = 2 and v = 0',
many: 'v = 0 and n != 0..10 and n % 10 = 0'
},
kab: {
one: 'i = 0,1'
},
kn: {
one: 'i = 0 or n = 1'
},
kw: {
one: 'n = 1',
two: 'n = 2'
},
lag: {
zero: 'n = 0',
one: 'i = 0,1 and n != 0'
},
ln: {
one: 'n = 0..1'
},
lt: {
one: 'n % 10 = 1 and n % 100 != 11..19',
few: 'n % 10 = 2..9 and n % 100 != 11..19',
many: 'f != 0'
},
lv: {
zero: 'n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19',
one: 'n % 10 = 1 and n % 100 != 11 or v = 2 and f % 10 = 1 and f % 100 != 11 or v != 2 and f % 10 = 1'
},
mg: {
one: 'n = 0..1'
},
mk: {
one: 'v = 0 and i % 10 = 1 or f % 10 = 1'
},
mo: {
one: 'i = 1 and v = 0',
few: 'v != 0 or n = 0 or n != 1 and n % 100 = 1..19'
},
mr: {
one: 'i = 0 or n = 1'
},
mt: {
one: 'n = 1',
few: 'n = 0 or n % 100 = 2..10',
many: 'n % 100 = 11..19'
},
naq: {
one: 'n = 1',
two: 'n = 2'
},
nso: {
one: 'n = 0..1'
},
pa: {
one: 'n = 0..1'
},
pl: {
one: 'i = 1 and v = 0',
few: 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14',
many: 'v = 0 and i != 1 and i % 10 = 0..1 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 12..14'
},
pt: {
one: 'i = 1 and v = 0 or i = 0 and t = 1'
},
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
pt_PT: {
one: 'n = 1 and v = 0'
},
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
ro: {
one: 'i = 1 and v = 0',
few: 'v != 0 or n = 0 or n != 1 and n % 100 = 1..19'
},
ru: {
one: 'v = 0 and i % 10 = 1 and i % 100 != 11',
many: 'v = 0 and i % 10 = 0 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 11..14'
},
se: {
one: 'n = 1',
two: 'n = 2'
},
sh: {
one: 'v = 0 and i % 10 = 1 and i % 100 != 11 or f % 10 = 1 and f % 100 != 11',
few: 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14'
},
shi: {
one: 'i = 0 or n = 1',
few: 'n = 2..10'
},
si: {
one: 'n = 0,1 or i = 0 and f = 1'
},
sk: {
one: 'i = 1 and v = 0',
few: 'i = 2..4 and v = 0',
many: 'v != 0'
},
sl: {
one: 'v = 0 and i % 100 = 1',
two: 'v = 0 and i % 100 = 2',
few: 'v = 0 and i % 100 = 3..4 or v != 0'
},
sma: {
one: 'n = 1',
two: 'n = 2'
},
smi: {
one: 'n = 1',
two: 'n = 2'
},
smj: {
one: 'n = 1',
two: 'n = 2'
},
smn: {
one: 'n = 1',
two: 'n = 2'
},
sms: {
one: 'n = 1',
two: 'n = 2'
},
sr: {
one: 'v = 0 and i % 10 = 1 and i % 100 != 11 or f % 10 = 1 and f % 100 != 11',
few: 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14'
},
ti: {
one: 'n = 0..1'
},
tl: {
one: 'i = 0..1 and v = 0'
},
tzm: {
one: 'n = 0..1 or n = 11..99'
},
uk: {
one: 'v = 0 and i % 10 = 1 and i % 100 != 11',
few: 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14',
many: 'v = 0 and i % 10 = 0 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 11..14'
},
wa: {
one: 'n = 0..1'
},
zu: {
one: 'i = 0 or n = 1'
}
},
/**
* Plural form transformations, needed for some languages.
*
* @param {integer} count
* Non-localized quantifier
* @param {Array} forms
* List of plural forms
* @return {string} Correct form for quantifier in this language
*/
convertPlural: function ( count, forms ) {
var pluralRules,
pluralFormIndex,
index,
explicitPluralPattern = new RegExp( '\\d+=', 'i' ),
formCount,
form;
if ( !forms || forms.length === 0 ) {
return '';
}
// Handle for Explicit 0= & 1= values
for ( index = 0; index < forms.length; index++ ) {
form = forms[ index ];
if ( explicitPluralPattern.test( form ) ) {
formCount = parseInt( form.slice( 0, form.indexOf( '=' ) ), 10 );
if ( formCount === count ) {
return ( form.slice( form.indexOf( '=' ) + 1 ) );
}
forms[ index ] = undefined;
}
}
forms = $.map( forms, function ( form ) {
if ( form !== undefined ) {
return form;
}
} );
pluralRules = this.pluralRules[ $.i18n().locale ];
if ( !pluralRules ) {
// default fallback.
return ( count === 1 ) ? forms[ 0 ] : forms[ 1 ];
}
pluralFormIndex = this.getPluralForm( count, pluralRules );
pluralFormIndex = Math.min( pluralFormIndex, forms.length - 1 );
return forms[ pluralFormIndex ];
},
/**
* For the number, get the plural for index
*
* @param {integer} number
* @param {Object} pluralRules
* @return {integer} plural form index
*/
getPluralForm: function ( number, pluralRules ) {
var i,
pluralForms = [ 'zero', 'one', 'two', 'few', 'many', 'other' ],
pluralFormIndex = 0;
for ( i = 0; i < pluralForms.length; i++ ) {
if ( pluralRules[ pluralForms[ i ] ] ) {
if ( pluralRuleParser( pluralRules[ pluralForms[ i ] ], number ) ) {
return pluralFormIndex;
}
pluralFormIndex++;
}
}
return pluralFormIndex;
},
/**
* Converts a number using digitTransformTable.
*
* @param {number} num Value to be converted
* @param {boolean} integer Convert the return value to an integer
*/
convertNumber: function ( num, integer ) {
var tmp, item, i,
transformTable, numberString, convertedNumber;
// Set the target Transform table:
transformTable = this.digitTransformTable( $.i18n().locale );
numberString = String( num );
convertedNumber = '';
if ( !transformTable ) {
return num;
}
// Check if the restore to Latin number flag is set:
if ( integer ) {
if ( parseFloat( num, 10 ) === num ) {
return num;
}
tmp = [];
for ( item in transformTable ) {
tmp[ transformTable[ item ] ] = item;
}
transformTable = tmp;
}
for ( i = 0; i < numberString.length; i++ ) {
if ( transformTable[ numberString[ i ] ] ) {
convertedNumber += transformTable[ numberString[ i ] ];
} else {
convertedNumber += numberString[ i ];
}
}
return integer ? parseFloat( convertedNumber, 10 ) : convertedNumber;
},
/**
* Grammatical transformations, needed for inflected languages.
* Invoked by putting {{grammar:form|word}} in a message.
* Override this method for languages that need special grammar rules
* applied dynamically.
*
* @param {string} word
* @param {string} form
* @return {string}
*/
convertGrammar: function ( word, form ) { /*jshint unused: false */
return word;
},
/**
* Provides an alternative text depending on specified gender. Usage
* {{gender:[gender|user object]|masculine|feminine|neutral}}. If second
* or third parameter are not specified, masculine is used.
*
* These details may be overriden per language.
*
* @param {string} gender
* male, female, or anything else for neutral.
* @param {Array} forms
* List of gender forms
*
* @return {string}
*/
gender: function ( gender, forms ) {
if ( !forms || forms.length === 0 ) {
return '';
}
while ( forms.length < 2 ) {
forms.push( forms[ forms.length - 1 ] );
}
if ( gender === 'male' ) {
return forms[ 0 ];
}
if ( gender === 'female' ) {
return forms[ 1 ];
}
return ( forms.length === 3 ) ? forms[ 2 ] : forms[ 0 ];
},
/**
* Get the digit transform table for the given language
* See http://cldr.unicode.org/translation/numbering-systems
*
* @param {string} language
* @return {Array|boolean} List of digits in the passed language or false
* representation, or boolean false if there is no information.
*/
digitTransformTable: function ( language ) {
var tables = {
ar: '٠١٢٣٤٥٦٧٨٩',
fa: '۰۱۲۳۴۵۶۷۸۹',
ml: '൦൧൨൩൪൫൬൭൮൯',
kn: '೦೧೨೩೪೫೬೭೮೯',
lo: '໐໑໒໓໔໕໖໗໘໙',
or: '୦୧୨୩୪୫୬୭୮୯',
kh: '០១២៣៤៥៦៧៨៩',
pa: '੦੧੨੩੪੫੬੭੮੯',
gu: '૦૧૨૩૪૫૬૭૮૯',
hi: '०१२३४५६७८९',
my: '၀၁၂၃၄၅၆၇၈၉',
ta: '௦௧௨௩௪௫௬௭௮௯',
te: '౦౧౨౩౪౫౬౭౮౯',
th: '๐๑๒๓๔๕๖๗๘๙', // FIXME use iso 639 codes
bo: '༠༡༢༣༤༥༦༧༨༩' // FIXME use iso 639 codes
};
if ( !tables[ language ] ) {
return false;
}
return tables[ language ].split( '' );
}
};
$.extend( $.i18n.languages, {
'default': language
} );
}( jQuery ) );

View File

@@ -1,126 +0,0 @@
/*!
* jQuery Internationalization library - Message Store
*
* Copyright (C) 2012 Santhosh Thottingal
*
* jquery.i18n is dual licensed GPLv2 or later and MIT. You don't have to do anything special to
* choose one license or the other and you don't have to notify anyone which license you are using.
* You are free to use UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
( function ( $, window, undefined ) {
'use strict';
var MessageStore = function () {
this.messages = {};
this.sources = {};
};
/**
* See https://github.com/wikimedia/jquery.i18n/wiki/Specification#wiki-Message_File_Loading
*/
MessageStore.prototype = {
/**
* General message loading API This can take a URL string for
* the json formatted messages.
* <code>load('path/to/all_localizations.json');</code>
*
* This can also load a localization file for a locale <code>
* load( 'path/to/de-messages.json', 'de' );
* </code>
* A data object containing message key- message translation mappings
* can also be passed Eg:
* <code>
* load( { 'hello' : 'Hello' }, optionalLocale );
* </code> If the data argument is
* null/undefined/false,
* all cached messages for the i18n instance will get reset.
*
* @param {string|Object} source
* @param {string} locale Language tag
* @return {jQuery.Promise}
*/
load: function ( source, locale ) {
var key = null,
deferred = null,
deferreds = [],
messageStore = this;
if ( typeof source === 'string' ) {
// This is a URL to the messages file.
$.i18n.log( 'Loading messages from: ' + source );
deferred = jsonMessageLoader( source )
.done( function ( localization ) {
messageStore.set( locale, localization );
} );
return deferred.promise();
}
if ( locale ) {
// source is an key-value pair of messages for given locale
messageStore.set( locale, source );
return $.Deferred().resolve();
} else {
// source is a key-value pair of locales and their source
for ( key in source ) {
if ( Object.prototype.hasOwnProperty.call( source, key ) ) {
locale = key;
// No {locale} given, assume data is a group of languages,
// call this function again for each language.
deferreds.push( messageStore.load( source[ key ], locale ) );
}
}
return $.when.apply( $, deferreds );
}
},
/**
* Set messages to the given locale.
* If locale exists, add messages to the locale.
*
* @param {string} locale
* @param {Object} messages
*/
set: function ( locale, messages ) {
if ( !this.messages[ locale ] ) {
this.messages[ locale ] = messages;
} else {
this.messages[ locale ] = $.extend( this.messages[ locale ], messages );
}
},
/**
*
* @param {string} locale
* @param {string} messageKey
* @return {boolean}
*/
get: function ( locale, messageKey ) {
return this.messages[ locale ] && this.messages[ locale ][ messageKey ];
}
};
function jsonMessageLoader( url ) {
var deferred = $.Deferred();
$.getJSON( url )
.done( deferred.resolve )
.fail( function ( jqxhr, settings, exception ) {
$.i18n.log( 'Error in loading messages from ' + url + ' Exception: ' + exception );
// Ignore 404 exception, because we are handling fallabacks explicitly
deferred.resolve();
} );
return deferred.promise();
}
$.extend( $.i18n.messageStore, new MessageStore() );
}( jQuery, window ) );

View File

@@ -1,309 +0,0 @@
/*!
* jQuery Internationalization library
*
* Copyright (C) 2011-2013 Santhosh Thottingal, Neil Kandalgaonkar
*
* jquery.i18n is dual licensed GPLv2 or later and MIT. You don't have to do
* anything special to choose one license or the other and you don't have to
* notify anyone which license you are using. You are free to use
* UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
( function ( $ ) {
'use strict';
var MessageParser = function ( options ) {
this.options = $.extend( {}, $.i18n.parser.defaults, options );
this.language = $.i18n.languages[ String.locale ] || $.i18n.languages[ 'default' ];
this.emitter = $.i18n.parser.emitter;
};
MessageParser.prototype = {
constructor: MessageParser,
simpleParse: function ( message, parameters ) {
return message.replace( /\$(\d+)/g, function ( str, match ) {
var index = parseInt( match, 10 ) - 1;
return parameters[ index ] !== undefined ? parameters[ index ] : '$' + match;
} );
},
parse: function ( message, replacements ) {
if ( message.indexOf( '{{' ) < 0 ) {
return this.simpleParse( message, replacements );
}
this.emitter.language = $.i18n.languages[ $.i18n().locale ] ||
$.i18n.languages[ 'default' ];
return this.emitter.emit( this.ast( message ), replacements );
},
ast: function ( message ) {
var pipe, colon, backslash, anyCharacter, dollar, digits, regularLiteral,
regularLiteralWithoutBar, regularLiteralWithoutSpace, escapedOrLiteralWithoutBar,
escapedOrRegularLiteral, templateContents, templateName, openTemplate,
closeTemplate, expression, paramExpression, result,
pos = 0;
// Try parsers until one works, if none work return null
function choice( parserSyntax ) {
return function () {
var i, result;
for ( i = 0; i < parserSyntax.length; i++ ) {
result = parserSyntax[ i ]();
if ( result !== null ) {
return result;
}
}
return null;
};
}
// Try several parserSyntax-es in a row.
// All must succeed; otherwise, return null.
// This is the only eager one.
function sequence( parserSyntax ) {
var i, res,
originalPos = pos,
result = [];
for ( i = 0; i < parserSyntax.length; i++ ) {
res = parserSyntax[ i ]();
if ( res === null ) {
pos = originalPos;
return null;
}
result.push( res );
}
return result;
}
// Run the same parser over and over until it fails.
// Must succeed a minimum of n times; otherwise, return null.
function nOrMore( n, p ) {
return function () {
var originalPos = pos,
result = [],
parsed = p();
while ( parsed !== null ) {
result.push( parsed );
parsed = p();
}
if ( result.length < n ) {
pos = originalPos;
return null;
}
return result;
};
}
// Helpers -- just make parserSyntax out of simpler JS builtin types
function makeStringParser( s ) {
var len = s.length;
return function () {
var result = null;
if ( message.slice( pos, pos + len ) === s ) {
result = s;
pos += len;
}
return result;
};
}
function makeRegexParser( regex ) {
return function () {
var matches = message.slice( pos ).match( regex );
if ( matches === null ) {
return null;
}
pos += matches[ 0 ].length;
return matches[ 0 ];
};
}
pipe = makeStringParser( '|' );
colon = makeStringParser( ':' );
backslash = makeStringParser( '\\' );
anyCharacter = makeRegexParser( /^./ );
dollar = makeStringParser( '$' );
digits = makeRegexParser( /^\d+/ );
regularLiteral = makeRegexParser( /^[^{}\[\]$\\]/ );
regularLiteralWithoutBar = makeRegexParser( /^[^{}\[\]$\\|]/ );
regularLiteralWithoutSpace = makeRegexParser( /^[^{}\[\]$\s]/ );
// There is a general pattern:
// parse a thing;
// if it worked, apply transform,
// otherwise return null.
// But using this as a combinator seems to cause problems
// when combined with nOrMore().
// May be some scoping issue.
function transform( p, fn ) {
return function () {
var result = p();
return result === null ? null : fn( result );
};
}
// Used to define "literals" within template parameters. The pipe
// character is the parameter delimeter, so by default
// it is not a literal in the parameter
function literalWithoutBar() {
var result = nOrMore( 1, escapedOrLiteralWithoutBar )();
return result === null ? null : result.join( '' );
}
function literal() {
var result = nOrMore( 1, escapedOrRegularLiteral )();
return result === null ? null : result.join( '' );
}
function escapedLiteral() {
var result = sequence( [ backslash, anyCharacter ] );
return result === null ? null : result[ 1 ];
}
choice( [ escapedLiteral, regularLiteralWithoutSpace ] );
escapedOrLiteralWithoutBar = choice( [ escapedLiteral, regularLiteralWithoutBar ] );
escapedOrRegularLiteral = choice( [ escapedLiteral, regularLiteral ] );
function replacement() {
var result = sequence( [ dollar, digits ] );
if ( result === null ) {
return null;
}
return [ 'REPLACE', parseInt( result[ 1 ], 10 ) - 1 ];
}
templateName = transform(
// see $wgLegalTitleChars
// not allowing : due to the need to catch "PLURAL:$1"
makeRegexParser( /^[ !"$&'()*,.\/0-9;=?@A-Z\^_`a-z~\x80-\xFF+\-]+/ ),
function ( result ) {
return result.toString();
}
);
function templateParam() {
var expr,
result = sequence( [ pipe, nOrMore( 0, paramExpression ) ] );
if ( result === null ) {
return null;
}
expr = result[ 1 ];
// use a "CONCAT" operator if there are multiple nodes,
// otherwise return the first node, raw.
return expr.length > 1 ? [ 'CONCAT' ].concat( expr ) : expr[ 0 ];
}
function templateWithReplacement() {
var result = sequence( [ templateName, colon, replacement ] );
return result === null ? null : [ result[ 0 ], result[ 2 ] ];
}
function templateWithOutReplacement() {
var result = sequence( [ templateName, colon, paramExpression ] );
return result === null ? null : [ result[ 0 ], result[ 2 ] ];
}
templateContents = choice( [
function () {
var res = sequence( [
// templates can have placeholders for dynamic
// replacement eg: {{PLURAL:$1|one car|$1 cars}}
// or no placeholders eg:
// {{GRAMMAR:genitive|{{SITENAME}}}
choice( [ templateWithReplacement, templateWithOutReplacement ] ),
nOrMore( 0, templateParam )
] );
return res === null ? null : res[ 0 ].concat( res[ 1 ] );
},
function () {
var res = sequence( [ templateName, nOrMore( 0, templateParam ) ] );
if ( res === null ) {
return null;
}
return [ res[ 0 ] ].concat( res[ 1 ] );
}
] );
openTemplate = makeStringParser( '{{' );
closeTemplate = makeStringParser( '}}' );
function template() {
var result = sequence( [ openTemplate, templateContents, closeTemplate ] );
return result === null ? null : result[ 1 ];
}
expression = choice( [ template, replacement, literal ] );
paramExpression = choice( [ template, replacement, literalWithoutBar ] );
function start() {
var result = nOrMore( 0, expression )();
if ( result === null ) {
return null;
}
return [ 'CONCAT' ].concat( result );
}
result = start();
/*
* For success, the pos must have gotten to the end of the input
* and returned a non-null.
* n.b. This is part of language infrastructure, so we do not throw an internationalizable message.
*/
if ( result === null || pos !== message.length ) {
throw new Error( 'Parse error at position ' + pos.toString() + ' in input: ' + message );
}
return result;
}
};
$.extend( $.i18n.parser, new MessageParser() );
}( jQuery ) );

View File

@@ -1,22 +0,0 @@
/**
* Bosnian (bosanski) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.bs = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'instrumental': // instrumental
word = 's ' + word;
break;
case 'lokativ': // locative
word = 'o ' + word;
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,22 +0,0 @@
/**
* Lower Sorbian (Dolnoserbski) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.dsb = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'instrumental': // instrumental
word = 'z ' + word;
break;
case 'lokatiw': // lokatiw
word = 'wo ' + word;
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,49 +0,0 @@
/**
* Finnish (Suomi) language functions
*
* @author Santhosh Thottingal
*/
( function ( $ ) {
'use strict';
$.i18n.languages.fi = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
// vowel harmony flag
var aou = word.match( /[aou][^äöy]*$/i ),
origWord = word;
if ( word.match( /wiki$/i ) ) {
aou = false;
}
// append i after final consonant
if ( word.match( /[bcdfghjklmnpqrstvwxz]$/i ) ) {
word += 'i';
}
switch ( form ) {
case 'genitive':
word += 'n';
break;
case 'elative':
word += ( aou ? 'sta' : 'stä' );
break;
case 'partitive':
word += ( aou ? 'a' : 'ä' );
break;
case 'illative':
// Double the last letter and add 'n'
word += word.slice( -1 ) + 'n';
break;
case 'inessive':
word += ( aou ? 'ssa' : 'ssä' );
break;
default:
word = origWord;
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,38 +0,0 @@
/**
* Irish (Gaeilge) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.ga = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
if ( form === 'ainmlae' ) {
switch ( word ) {
case 'an Domhnach':
word = 'Dé Domhnaigh';
break;
case 'an Luan':
word = 'Dé Luain';
break;
case 'an Mháirt':
word = 'Dé Mháirt';
break;
case 'an Chéadaoin':
word = 'Dé Chéadaoin';
break;
case 'an Déardaoin':
word = 'Déardaoin';
break;
case 'an Aoine':
word = 'Dé hAoine';
break;
case 'an Satharn':
word = 'Dé Sathairn';
break;
}
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,31 +0,0 @@
/**
* Hebrew (עברית) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.he = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'prefixed':
case 'תחילית': // the same word in Hebrew
// Duplicate prefixed "Waw", but only if it's not already double
if ( word.slice( 0, 1 ) === 'ו' && word.slice( 0, 2 ) !== 'וו' ) {
word = 'ו' + word;
}
// Remove the "He" if prefixed
if ( word.slice( 0, 1 ) === 'ה' ) {
word = word.slice( 1 );
}
// Add a hyphen (maqaf) before numbers and non-Hebrew letters
if ( word.slice( 0, 1 ) < 'א' || word.slice( 0, 1 ) > 'ת' ) {
word = '־' + word;
}
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,21 +0,0 @@
/**
* Upper Sorbian (Hornjoserbsce) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.hsb = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'instrumental': // instrumental
word = 'z ' + word;
break;
case 'lokatiw': // lokatiw
word = 'wo ' + word;
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,26 +0,0 @@
/**
* Hungarian language functions
*
* @author Santhosh Thottingal
*/
( function ( $ ) {
'use strict';
$.i18n.languages.hu = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'rol':
word += 'ról';
break;
case 'ba':
word += 'ba';
break;
case 'k':
word += 'k';
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,25 +0,0 @@
/**
* Armenian (Հայերեն) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.hy = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
if ( form === 'genitive' ) { // սեռական հոլով
if ( word.slice( -1 ) === 'ա' ) {
word = word.slice( 0, -1 ) + 'այի';
} else if ( word.slice( -1 ) === 'ո' ) {
word = word.slice( 0, -1 ) + 'ոյի';
} else if ( word.slice( -4 ) === 'գիրք' ) {
word = word.slice( 0, -4 ) + 'գրքի';
} else {
word = word + 'ի';
}
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,54 +0,0 @@
/**
* Latin (lingua Latina) language functions
*
* @author Santhosh Thottingal
*/
( function ( $ ) {
'use strict';
$.i18n.languages.la = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'genitive':
// only a few declensions, and even for those mostly the singular only
word = word.replace( /u[ms]$/i, 'i' ); // 2nd declension singular
word = word.replace( /ommunia$/i, 'ommunium' ); // 3rd declension neuter plural (partly)
word = word.replace( /a$/i, 'ae' ); // 1st declension singular
word = word.replace( /libri$/i, 'librorum' ); // 2nd declension plural (partly)
word = word.replace( /nuntii$/i, 'nuntiorum' ); // 2nd declension plural (partly)
word = word.replace( /tio$/i, 'tionis' ); // 3rd declension singular (partly)
word = word.replace( /ns$/i, 'ntis' );
word = word.replace( /as$/i, 'atis' );
word = word.replace( /es$/i, 'ei' ); // 5th declension singular
break;
case 'accusative':
// only a few declensions, and even for those mostly the singular only
word = word.replace( /u[ms]$/i, 'um' ); // 2nd declension singular
word = word.replace( /ommunia$/i, 'am' ); // 3rd declension neuter plural (partly)
word = word.replace( /a$/i, 'ommunia' ); // 1st declension singular
word = word.replace( /libri$/i, 'libros' ); // 2nd declension plural (partly)
word = word.replace( /nuntii$/i, 'nuntios' );// 2nd declension plural (partly)
word = word.replace( /tio$/i, 'tionem' ); // 3rd declension singular (partly)
word = word.replace( /ns$/i, 'ntem' );
word = word.replace( /as$/i, 'atem' );
word = word.replace( /es$/i, 'em' ); // 5th declension singular
break;
case 'ablative':
// only a few declensions, and even for those mostly the singular only
word = word.replace( /u[ms]$/i, 'o' ); // 2nd declension singular
word = word.replace( /ommunia$/i, 'ommunibus' ); // 3rd declension neuter plural (partly)
word = word.replace( /a$/i, 'a' ); // 1st declension singular
word = word.replace( /libri$/i, 'libris' ); // 2nd declension plural (partly)
word = word.replace( /nuntii$/i, 'nuntiis' ); // 2nd declension plural (partly)
word = word.replace( /tio$/i, 'tione' ); // 3rd declension singular (partly)
word = word.replace( /ns$/i, 'nte' );
word = word.replace( /as$/i, 'ate' );
word = word.replace( /es$/i, 'e' ); // 5th declension singular
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,98 +0,0 @@
/**
* Malayalam language functions
*
* @author Santhosh Thottingal
*/
( function ( $ ) {
'use strict';
$.i18n.languages.ml = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
form = form.toLowerCase();
switch ( form ) {
case 'ഉദ്ദേശിക':
case 'dative':
if ( word.slice( -1 ) === 'ു' ||
word.slice( -1 ) === 'ൂ' ||
word.slice( -1 ) === 'ൗ' ||
word.slice( -1 ) === 'ൌ'
) {
word += 'വിന്';
} else if ( word.slice( -1 ) === '' ) {
word = word.slice( 0, -1 ) + 'ത്തിന്';
} else if ( word.slice( -1 ) === 'ൻ' ) {
// Atomic chillu n. അവൻ -> അവന്
word = word.slice( 0, -1 ) + 'ന്';
} else if ( word.slice( -3 ) === 'ന്\u200d' ) {
// chillu n. അവൻ -> അവന്
word = word.slice( 0, -1 );
} else if ( word.slice( -1 ) === 'ൾ' || word.slice( -3 ) === 'ള്\u200d' ) {
word += 'ക്ക്';
} else if ( word.slice( -1 ) === 'ർ' || word.slice( -3 ) === 'ര്\u200d' ) {
word += 'ക്ക്';
} else if ( word.slice( -1 ) === 'ൽ' ) {
// Atomic chillu ൽ , ഫയൽ -> ഫയലിന്
word = word.slice( 0, -1 ) + 'ലിന്';
} else if ( word.slice( -3 ) === 'ല്\u200d' ) {
// chillu ല്\u200d , ഫയല്\u200d -> ഫയലിന്
word = word.slice( 0, -2 ) + 'ിന്';
} else if ( word.slice( -2 ) === 'ു്' ) {
word = word.slice( 0, -2 ) + 'ിന്';
} else if ( word.slice( -1 ) === '്' ) {
word = word.slice( 0, -1 ) + 'ിന്';
} else {
// കാവ്യ -> കാവ്യയ്ക്ക്, ഹരി -> ഹരിയ്ക്ക്, മല -> മലയ്ക്ക്
word += 'യ്ക്ക്';
}
break;
case 'സംബന്ധിക':
case 'genitive':
if ( word.slice( -1 ) === '' ) {
word = word.slice( 0, -1 ) + 'ത്തിന്റെ';
} else if ( word.slice( -2 ) === 'ു്' ) {
word = word.slice( 0, -2 ) + 'ിന്റെ';
} else if ( word.slice( -1 ) === '്' ) {
word = word.slice( 0, -1 ) + 'ിന്റെ';
} else if ( word.slice( -1 ) === 'ു' ||
word.slice( -1 ) === 'ൂ' ||
word.slice( -1 ) === 'ൗ' ||
word.slice( -1 ) === 'ൌ'
) {
word += 'വിന്റെ';
} else if ( word.slice( -1 ) === 'ൻ' ) {
// Atomic chillu n. അവൻ -> അവന്റെ
word = word.slice( 0, -1 ) + 'ന്റെ';
} else if ( word.slice( -3 ) === 'ന്\u200d' ) {
// chillu n. അവൻ -> അവന്റെ
word = word.slice( 0, -1 ) + 'റെ';
} else if ( word.slice( -3 ) === 'ള്\u200d' ) {
// chillu n. അവൾ -> അവളുടെ
word = word.slice( 0, -2 ) + 'ുടെ';
} else if ( word.slice( -1 ) === 'ൾ' ) {
// Atomic chillu n. അവള്\u200d -> അവളുടെ
word = word.slice( 0, -1 ) + 'ളുടെ';
} else if ( word.slice( -1 ) === 'ൽ' ) {
// Atomic l. മുയല്\u200d -> മുയലിന്റെ
word = word.slice( 0, -1 ) + 'ലിന്റെ';
} else if ( word.slice( -3 ) === 'ല്\u200d' ) {
// chillu l. മുയല്\u200d -> അവളുടെ
word = word.slice( 0, -2 ) + 'ിന്റെ';
} else if ( word.slice( -3 ) === 'ര്\u200d' ) {
// chillu r. അവര്\u200d -> അവരുടെ
word = word.slice( 0, -2 ) + 'ുടെ';
} else if ( word.slice( -1 ) === 'ർ' ) {
// Atomic chillu r. അവർ -> അവരുടെ
word = word.slice( 0, -1 ) + 'രുടെ';
} else {
word += 'യുടെ';
}
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,76 +0,0 @@
/**
* Ossetian (Ирон) language functions
*
* @author Santhosh Thottingal
*/
( function ( $ ) {
'use strict';
$.i18n.languages.os = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
var endAllative, jot, hyphen, ending;
// Ending for allative case
endAllative = 'мæ';
// Variable for 'j' beetwen vowels
jot = '';
// Variable for "-" for not Ossetic words
hyphen = '';
// Variable for ending
ending = '';
if ( word.match( /тæ$/i ) ) {
// Checking if the $word is in plural form
word = word.slice( 0, -1 );
endAllative = 'æм';
} else if ( word.match( /[аæеёиоыэюя]$/i ) ) {
// Works if word is in singular form.
// Checking if word ends on one of the vowels: е, ё, и, о, ы, э, ю,
// я.
jot = 'й';
} else if ( word.match( /у$/i ) ) {
// Checking if word ends on 'у'. 'У' can be either consonant 'W' or
// vowel 'U' in cyrillic Ossetic.
// Examples: {{grammar:genitive|аунеу}} = аунеуы,
// {{grammar:genitive|лæппу}} = лæппуйы.
if ( !word.slice( -2, -1 )
.match( /[аæеёиоыэюя]$/i ) ) {
jot = 'й';
}
} else if ( !word.match( /[бвгджзйклмнопрстфхцчшщьъ]$/i ) ) {
hyphen = '-';
}
switch ( form ) {
case 'genitive':
ending = hyphen + jot + 'ы';
break;
case 'dative':
ending = hyphen + jot + 'æн';
break;
case 'allative':
ending = hyphen + endAllative;
break;
case 'ablative':
if ( jot === 'й' ) {
ending = hyphen + jot + 'æ';
} else {
ending = hyphen + jot + 'æй';
}
break;
case 'superessive':
ending = hyphen + jot + 'ыл';
break;
case 'equative':
ending = hyphen + jot + 'ау';
break;
case 'comitative':
ending = hyphen + 'имæ';
break;
}
return word + ending;
}
} );
}( jQuery ) );

View File

@@ -1,29 +0,0 @@
/**
* Russian (Русский) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.ru = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
if ( form === 'genitive' ) { // родительный падеж
if ( word.slice( -1 ) === 'ь' ) {
word = word.slice( 0, -1 ) + 'я';
} else if ( word.slice( -2 ) === 'ия' ) {
word = word.slice( 0, -2 ) + 'ии';
} else if ( word.slice( -2 ) === 'ка' ) {
word = word.slice( 0, -2 ) + 'ки';
} else if ( word.slice( -2 ) === 'ти' ) {
word = word.slice( 0, -2 ) + 'тей';
} else if ( word.slice( -2 ) === 'ды' ) {
word = word.slice( 0, -2 ) + 'дов';
} else if ( word.slice( -3 ) === 'ник' ) {
word = word.slice( 0, -3 ) + 'ника';
}
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,26 +0,0 @@
/**
* Slovenian (Slovenščina) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.sl = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
// locative
case 'mestnik':
word = 'o ' + word;
break;
// instrumental
case 'orodnik':
word = 'z ' + word;
break;
}
return word;
}
} );
}( jQuery ) );

View File

@@ -1,39 +0,0 @@
/**
* Ukrainian (Українська) language functions
*/
( function ( $ ) {
'use strict';
$.i18n.languages.uk = $.extend( {}, $.i18n.languages[ 'default' ], {
convertGrammar: function ( word, form ) {
switch ( form ) {
case 'genitive': // родовий відмінок
if ( word.slice( -1 ) === 'ь' ) {
word = word.slice( 0, -1 ) + 'я';
} else if ( word.slice( -2 ) === 'ія' ) {
word = word.slice( 0, -2 ) + 'ії';
} else if ( word.slice( -2 ) === 'ка' ) {
word = word.slice( 0, -2 ) + 'ки';
} else if ( word.slice( -2 ) === 'ти' ) {
word = word.slice( 0, -2 ) + 'тей';
} else if ( word.slice( -2 ) === 'ды' ) {
word = word.slice( 0, -2 ) + 'дов';
} else if ( word.slice( -3 ) === 'ник' ) {
word = word.slice( 0, -3 ) + 'ника';
}
break;
case 'accusative': // знахідний відмінок
if ( word.slice( -2 ) === 'ія' ) {
word = word.slice( 0, -2 ) + 'ію';
}
break;
}
return word;
}
} );
}( jQuery ) );