aboutsummaryrefslogtreecommitdiffstats
path: root/resources/lib/moment/locale/sr.js
diff options
context:
space:
mode:
authorJames D. Forrester <jforrester@wikimedia.org>2025-03-27 18:52:52 -0400
committerJames D. Forrester <jforrester@wikimedia.org>2025-04-06 08:22:16 -0400
commitc2b16b995d9db4f2da14af5e55bded40cbff82d2 (patch)
tree0d168c2e822a176f95f32e904c0bed5b8f0b312a /resources/lib/moment/locale/sr.js
parent2a5cf3fde93263156557bc1efd21c5a74ce67725 (diff)
downloadmediawikicore-c2b16b995d9db4f2da14af5e55bded40cbff82d2.tar.gz
mediawikicore-c2b16b995d9db4f2da14af5e55bded40cbff82d2.zip
Upgrade moment from v2.25.2 to v2.30.1
Five new locales, two of which map to supported languages in core (ku-kmr -> ku, and tk -> tk), and three of which don't but are added in for future support and for languages that might be configured in production systems (ar-ps, bn-bd, and es-mx). Bug: T389416 Change-Id: Ic69ddf92f922515bf36a2ea1770b2c8ebd2c46b2
Diffstat (limited to 'resources/lib/moment/locale/sr.js')
-rw-r--r--resources/lib/moment/locale/sr.js66
1 files changed, 39 insertions, 27 deletions
diff --git a/resources/lib/moment/locale/sr.js b/resources/lib/moment/locale/sr.js
index 8cf996e6a888..8f53e7ccf60f 100644
--- a/resources/lib/moment/locale/sr.js
+++ b/resources/lib/moment/locale/sr.js
@@ -1,6 +1,7 @@
//! moment.js locale configuration
//! locale : Serbian [sr]
//! author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
+//! author : Stefan Crnjaković <stefan@hotmail.rs> : https://github.com/crnjakovic
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined'
@@ -15,32 +16,44 @@
words: {
//Different grammatical cases
ss: ['sekunda', 'sekunde', 'sekundi'],
- m: ['jedan minut', 'jedne minute'],
- mm: ['minut', 'minute', 'minuta'],
+ m: ['jedan minut', 'jednog minuta'],
+ mm: ['minut', 'minuta', 'minuta'],
h: ['jedan sat', 'jednog sata'],
hh: ['sat', 'sata', 'sati'],
+ d: ['jedan dan', 'jednog dana'],
dd: ['dan', 'dana', 'dana'],
+ M: ['jedan mesec', 'jednog meseca'],
MM: ['mesec', 'meseca', 'meseci'],
- yy: ['godina', 'godine', 'godina'],
+ y: ['jednu godinu', 'jedne godine'],
+ yy: ['godinu', 'godine', 'godina'],
},
correctGrammaticalCase: function (number, wordKey) {
- return number === 1
- ? wordKey[0]
- : number >= 2 && number <= 4
- ? wordKey[1]
- : wordKey[2];
+ if (
+ number % 10 >= 1 &&
+ number % 10 <= 4 &&
+ (number % 100 < 10 || number % 100 >= 20)
+ ) {
+ return number % 10 === 1 ? wordKey[0] : wordKey[1];
+ }
+ return wordKey[2];
},
- translate: function (number, withoutSuffix, key) {
- var wordKey = translator.words[key];
+ translate: function (number, withoutSuffix, key, isFuture) {
+ var wordKey = translator.words[key],
+ word;
+
if (key.length === 1) {
- return withoutSuffix ? wordKey[0] : wordKey[1];
- } else {
- return (
- number +
- ' ' +
- translator.correctGrammaticalCase(number, wordKey)
- );
+ // Nominativ
+ if (key === 'y' && withoutSuffix) return 'jedna godina';
+ return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
+ }
+
+ word = translator.correctGrammaticalCase(number, wordKey);
+ // Nominativ
+ if (key === 'yy' && withoutSuffix && word === 'godinu') {
+ return number + ' godina';
}
+
+ return number + ' ' + word;
},
};
@@ -48,9 +61,8 @@
months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split(
'_'
),
- monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split(
- '_'
- ),
+ monthsShort:
+ 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'),
monthsParseExact: true,
weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split(
'_'
@@ -61,10 +73,10 @@
longDateFormat: {
LT: 'H:mm',
LTS: 'H:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY H:mm',
- LLLL: 'dddd, D. MMMM YYYY H:mm',
+ L: 'D. M. YYYY.',
+ LL: 'D. MMMM YYYY.',
+ LLL: 'D. MMMM YYYY. H:mm',
+ LLLL: 'dddd, D. MMMM YYYY. H:mm',
},
calendar: {
sameDay: '[danas u] LT',
@@ -108,11 +120,11 @@
mm: translator.translate,
h: translator.translate,
hh: translator.translate,
- d: 'dan',
+ d: translator.translate,
dd: translator.translate,
- M: 'mesec',
+ M: translator.translate,
MM: translator.translate,
- y: 'godinu',
+ y: translator.translate,
yy: translator.translate,
},
dayOfMonthOrdinalParse: /\d{1,2}\./,