Localisation issues in `sk.js` (Slovak)
See original GitHub issueThere are some issues in sk.js:
ordinal: n => `${n}º`,→ordinal: n => `${n}.`,:- there should a dot after ordinal numbers;
L: 'DD.MM.YYYY',→L: 'DD. MM. YYYY',:- according to STN 01 6910 (in Slovak), the spaces after each dot in the date is prefered, but the spaces can be omitted, therefore this is not an issue per se;
weekdays: 'Nedeľa_Pondelok_Utorok_Streda_Štvrtok_Piatok_Sobota'.split('_'),→weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),weekdaysShort: 'Ne_Po_Ut_St_Št_Pi_So'.split('_'),→weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'),.
Then there is as an issue with the the numbers of and declension of the nouns (see also #302). The grammatical rules in Slovak are quite similar to those in Czech, therefore I have just copied the plural() and translate() functions from there and replaced the nouns with the Slovak ones. I would open a PR with this, but I am not a good coder, therefore this must be reviewed.
All in all, here is the proposed content of sk.js. I hope I did not made any mistakes. I have added some comments to make it easier to check if the words are really those that should be assigned to the particular key.
sk.js
// Slovak [sk]
import dayjs from 'dayjs'
function plural(n) {
return (n > 1) && (n < 5) && (~~(n / 10) !== 1) // eslint-disable-line
}
/* eslint-disable */
function translate(number, withoutSuffix, key, isFuture) {
const result = `${number} `
switch (key) {
case 's': // a few seconds / in a few seconds / a few seconds ago
// in a few seconds / a few seconds ago
return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami'
case 'm': // a minute / in a minute / a minute ago
return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou')
case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
if (withoutSuffix || isFuture) {
// 2-4 minutes / 5+ minutes
return result + (plural(number) ? 'minúty' : 'minút')
}
// 2+ minutes ago
return `${result}minútami`
case 'h': // an hour / in an hour / an hour ago
return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou')
case 'hh': // 9 hours / in 9 hours / 9 hours ago
if (withoutSuffix || isFuture) {
// 2-4 hours / 5+ hours
return result + (plural(number) ? 'hodiny' : 'hodín')
}
// 2+ hours ago
return `${result}hodinami`
case 'd': // a day / in a day / a day ago
// in a day / a day ago
return (withoutSuffix || isFuture) ? 'deň' : 'dňom'
case 'dd': // 9 days / in 9 days / 9 days ago
if (withoutSuffix || isFuture) {
// 2-4 days / 5+ days
return result + (plural(number) ? 'dni' : 'dní')
}
// 2+ days ago
return `${result}dny`
case 'M': // a month / in a month / a month ago
// in a month / a month ago
return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom'
case 'MM': // 9 months / in 9 months / 9 months ago
if (withoutSuffix || isFuture) {
// 2-4 months / 5+ months
return result + (plural(number) ? 'mesiace' : 'mesiacov')
}
// 2+ months ago
return `${result}mesiacmi`
case 'y': // a year / in a year / a year ago
// in a year / a year ago
return (withoutSuffix || isFuture) ? 'rok' : 'rokom'
case 'yy': // 9 years / in 9 years / 9 years ago
if (withoutSuffix || isFuture) {
// 2-4 years / 5+ years
return result + (plural(number) ? 'roky' : 'rokov')
}
// 2+ year ago
return `${result}rokmi`
}
}
/* eslint-enable */
const locale = {
name: 'sk',
weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'),
weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'),
months: 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'),
monthsShort: 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'),
weekStart: 1,
relativeTime: {
future: 'o %s',
past: 'pred %s',
s: 'niekoľko sekúnd',
m: 'minúta',
mm: '%d minút',
h: 'hodina',
hh: '%d hodín',
d: 'deň',
dd: '%d dní',
M: 'mesiac',
MM: '%d mesiacov',
y: 'rok',
yy: '%d rokov'
},
ordinal: n => `${n}.`,
formats: {
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'
}
}
dayjs.locale(locale, null, true)
export default locale
PS—@prantlf, can I ask you to check the translate() function? Thanks in advance! 😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:37 (37 by maintainers)
Top Results From Across the Web
Localisation issues in `sk.js` (Slovak) #831 - Issuehunt
IssueHunt = OSS Development ⚒ + Bounty Program . IssueHunt is an issue-based bounty platform for open source projects. Anyone can put a...
Read more >sk.js : Fix l10n issues (czechisms) #5408 - GitHub
In Slovak, the correct preposition is o in the phrase. ... For example: use o pár second instead of za pár sekúnd (meaning:...
Read more >Kendo UI Slovak localization - Telerik
Hi all, I have translated Kendo UI messages for Slovak language for version 2014.3.1316. Files in attachment: kendo.messages.sk-SK.js ...
Read more >BotDetect CAPTCHA Slovak Localization
This page contains the details of Slovak Captcha (Slovácka Captcha) locales fully supported by BotDetect, for which there are both localized Captcha images ......
Read more >Localization | Overview | ArcGIS Maps SDK for JavaScript 4.25
How does localization work with the ArcGIS for JavaScript API? ... Russian (ru); Serbian (sr) - Added in version 4.1; Slovak (sk) -...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

can we give them 1 month first 😬 , then we could update it ourself
ref2 https://github.com/moment/moment/blob/develop/locale/sk.js