Skip to content

Commit

Permalink
[misc] fix lint issues (#5762)
Browse files Browse the repository at this point in the history
  • Loading branch information
marwahaha committed Oct 26, 2020
1 parent c1f4568 commit a68ba47
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
23 changes: 12 additions & 11 deletions src/locale/sr-cyrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,31 @@ var translator = {
yy: ['годину', 'године', 'година'],
},
correctGrammaticalCase: function (number, wordKey) {
if (number % 10 >= 1 && number % 10 <= 4 && (number % 100 < 10 || number % 100 >= 20)) {
return number % 10 === 1 ? wordKey[0] : wordKey[1]
if (
number % 10 >= 1 &&
number % 10 <= 4 &&
(number % 100 < 10 || number % 100 >= 20)
) {
return number % 10 === 1 ? wordKey[0] : wordKey[1];
}
return wordKey[2]
return wordKey[2];
},
translate: function (number, withoutSuffix, key, isFuture) {
var wordKey = translator.words[key];

if (key.length === 1) {
// Nominativ
if (key === 'y' && withoutSuffix) return 'једна година'
if (key === 'y' && withoutSuffix) return 'једна година';
return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
}

const word = translator.correctGrammaticalCase(number, wordKey)
const word = translator.correctGrammaticalCase(number, wordKey);
// Nominativ
if (
key === 'yy' &&
withoutSuffix &&
word === 'годину') {
return (number + ' година')
if (key === 'yy' && withoutSuffix && word === 'годину') {
return number + ' година';
}

return (number + ' ' + word);
return number + ' ' + word;
},
};

Expand Down
24 changes: 12 additions & 12 deletions src/locale/sr.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { without } from 'lodash';
//! moment.js locale configuration
//! locale : Serbian [sr]
//! author : Milan Janačković<milanjanackovic@gmail.com> : https://github.com/milan-j
Expand All @@ -22,30 +21,31 @@ var translator = {
yy: ['godinu', 'godine', 'godina'],
},
correctGrammaticalCase: function (number, wordKey) {
if (number % 10 >= 1 && number % 10 <= 4 && (number % 100 < 10 || number % 100 >= 20)) {
return number % 10 === 1 ? wordKey[0] : wordKey[1]
if (
number % 10 >= 1 &&
number % 10 <= 4 &&
(number % 100 < 10 || number % 100 >= 20)
) {
return number % 10 === 1 ? wordKey[0] : wordKey[1];
}
return wordKey[2]
return wordKey[2];
},
translate: function (number, withoutSuffix, key, isFuture) {
var wordKey = translator.words[key];

if (key.length === 1) {
// Nominativ
if (key === 'y' && withoutSuffix) return 'jedna godina'
if (key === 'y' && withoutSuffix) return 'jedna godina';
return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
}

const word = translator.correctGrammaticalCase(number, wordKey)
const word = translator.correctGrammaticalCase(number, wordKey);
// Nominativ
if (
key === 'yy' &&
withoutSuffix &&
word === 'godinu') {
return (number + ' godina')
if (key === 'yy' && withoutSuffix && word === 'godinu') {
return number + ' godina';
}

return (number + ' ' + word);
return number + ' ' + word;
},
};

Expand Down

0 comments on commit a68ba47

Please sign in to comment.