From cf2ea3eb8ea103a6328e1c5071385ae81a2ff9b8 Mon Sep 17 00:00:00 2001 From: Oscar Otero Date: Thu, 20 Jul 2017 08:05:13 +0200 Subject: [PATCH 1/2] Added galician (gl) locale --- locales/gl.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 locales/gl.js diff --git a/locales/gl.js b/locales/gl.js new file mode 100644 index 0000000..078d100 --- /dev/null +++ b/locales/gl.js @@ -0,0 +1,18 @@ +module.exports = function(number, index) { + return [ + ['xusto agora', 'daquí a un pouco'], + ['hai %s segundos', 'en %s segundos'], + ['hai 1 minuto', 'nun minuto'], + ['hai %s minutos', 'en %s minutos'], + ['hai 1 hora', 'nunha hora'], + ['hai %s horas', 'en %s horas'], + ['hai 1 día', 'nun día'], + ['hai %s días', 'en %s días'], + ['hai 1 semana', 'nunha semana'], + ['hai %s semanas', 'en %s semanas'], + ['hai 1 mes', 'nun mes'], + ['hai %s meses', 'en %s meses'], + ['hai 1 ano', 'nun ano'], + ['hai %s anos', 'en %s anos'] + ][index]; +}; From c89873cbc9277b65e468ed5b7cabd6b76972bec5 Mon Sep 17 00:00:00 2001 From: Oscar Otero Date: Thu, 20 Jul 2017 09:53:11 +0200 Subject: [PATCH 2/2] added tests --- locales/locales.js | 2 +- tests/locales/gl.js | 63 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tests/locales/gl.js diff --git a/locales/locales.js b/locales/locales.js index cc3befb..0bf5f31 100644 --- a/locales/locales.js +++ b/locales/locales.js @@ -3,4 +3,4 @@ * 1. please sort by dictionary. * 2. please ensure the accuracy. */ -module.exports = [ 'ar', 'be', 'bg', 'ca', 'da', 'de', 'el', 'en', 'en_short', 'es', 'eu', 'fa', 'fi', 'fr', 'he', 'hu', 'in_BG', 'in_HI', 'in_ID', 'it', 'ja', 'ko', 'ml', 'my', 'nb_NO', 'nl', 'nn_NO', 'pl', 'pt_BR', 'ro', 'ru', 'sv', 'ta', 'th', 'tr', 'uk', 'vi', 'zh_CN', 'zh_TW' ]; +module.exports = [ 'ar', 'be', 'bg', 'ca', 'da', 'de', 'el', 'en', 'en_short', 'es', 'eu', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'in_BG', 'in_HI', 'in_ID', 'it', 'ja', 'ko', 'ml', 'my', 'nb_NO', 'nl', 'nn_NO', 'pl', 'pt_BR', 'ro', 'ru', 'sv', 'ta', 'th', 'tr', 'uk', 'vi', 'zh_CN', 'zh_TW' ]; diff --git a/tests/locales/gl.js b/tests/locales/gl.js new file mode 100644 index 0000000..9bbbe8e --- /dev/null +++ b/tests/locales/gl.js @@ -0,0 +1,63 @@ +module.exports = function(t, tb) { + // test second + t.equal(tb.subSeconds(1), 'xusto agora'); + t.equal(tb.subSeconds(10), 'hai 10 segundos'); + t.equal(tb.subSeconds(21), 'hai 21 segundos'); + t.equal(tb.subSeconds(22), 'hai 22 segundos'); + t.equal(tb.addSeconds(1), 'daquí a un pouco'); + t.equal(tb.addSeconds(10), 'en 10 segundos'); + t.equal(tb.addSeconds(21), 'en 21 segundos'); + t.equal(tb.addSeconds(22), 'en 22 segundos'); + + // test minute + t.equal(tb.subMinutes(1), 'hai 1 minuto'); + t.equal(tb.subMinutes(2), 'hai 2 minutos'); + t.equal(tb.subMinutes(5), 'hai 5 minutos'); + t.equal(tb.subMinutes(21), 'hai 21 minutos'); + t.equal(tb.addMinutes(1), 'nun minuto'); + t.equal(tb.addMinutes(2), 'en 2 minutos'); + t.equal(tb.addMinutes(5), 'en 5 minutos'); + t.equal(tb.addMinutes(21), 'en 21 minutos'); + + // test hour + t.equal(tb.subHours(1), 'hai 1 hora'); + t.equal(tb.subHours(2), 'hai 2 horas'); + t.equal(tb.subHours(5), 'hai 5 horas'); + t.equal(tb.subHours(21), 'hai 21 horas'); + t.equal(tb.addHours(1), 'nunha hora'); + t.equal(tb.addHours(2), 'en 2 horas'); + t.equal(tb.addHours(5), 'en 5 horas'); + t.equal(tb.addHours(21), 'en 21 horas'); + + // test day + t.equal(tb.subDays(1), 'hai 1 día'); + t.equal(tb.subDays(2), 'hai 2 días'); + t.equal(tb.subDays(5), 'hai 5 días'); + t.equal(tb.addDays(1), 'nun día'); + t.equal(tb.addDays(2), 'en 2 días'); + t.equal(tb.addDays(5), 'en 5 días'); + + // test week + t.equal(tb.subWeeks(1), 'hai 1 semana'); + t.equal(tb.subWeeks(2), 'hai 2 semanas'); + t.equal(tb.addWeeks(1), 'nunha semana'); + t.equal(tb.addWeeks(2), 'en 2 semanas'); + + // test month + t.equal(tb.subMonths(1), 'hai 1 mes'); + t.equal(tb.subMonths(2), 'hai 2 meses'); + t.equal(tb.subMonths(5), 'hai 5 meses'); + t.equal(tb.addMonths(1), 'nun mes'); + t.equal(tb.addMonths(2), 'en 2 meses'); + t.equal(tb.addMonths(5), 'en 5 meses'); + + // test year + t.equal(tb.subYears(1), 'hai 1 ano'); + t.equal(tb.subYears(2), 'hai 2 anos'); + t.equal(tb.subYears(5), 'hai 5 anos'); + t.equal(tb.subYears(21), 'hai 21 anos'); + t.equal(tb.addYears(1), 'nun ano'); + t.equal(tb.addYears(2), 'en 2 anos'); + t.equal(tb.addYears(5), 'en 5 anos'); + t.equal(tb.addYears(21), 'en 21 anos'); +}; \ No newline at end of file