From a0355dbbe8315e2a89786c7cecd8aefa66016ffb Mon Sep 17 00:00:00 2001 From: Artur Paikin Date: Tue, 19 Mar 2019 14:45:56 +0300 Subject: [PATCH] use stubs instead of removed locales --- packages/@uppy/utils/src/Translator.test.js | 43 +++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/packages/@uppy/utils/src/Translator.test.js b/packages/@uppy/utils/src/Translator.test.js index 952c3c96f4..e0c9e07909 100644 --- a/packages/@uppy/utils/src/Translator.test.js +++ b/packages/@uppy/utils/src/Translator.test.js @@ -1,7 +1,44 @@ const Translator = require('./Translator') -// TODO use stubs instead -const russian = require('../../../../locales/ru_RU') -const english = require('../../../../locales/en_US') + +const english = { + strings: { + chooseFile: 'Choose a file', + youHaveChosen: 'You have chosen: %{fileName}', + filesChosen: { + 0: '%{smart_count} file selected', + 1: '%{smart_count} files selected' + }, + pluralize: function (n) { + if (n === 1) { + return 0 + } + return 1 + } + } +} + +const russian = { + strings: { + chooseFile: 'Выберите файл', + youHaveChosen: 'Вы выбрали: %{file_name}', + filesChosen: { + 0: 'Выбран %{smart_count} файл', + 1: 'Выбрано %{smart_count} файла', + 2: 'Выбрано %{smart_count} файлов' + } + }, + pluralize: function (n) { + if (n % 10 === 1 && n % 100 !== 11) { + return 0 + } + + if (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20)) { + return 1 + } + + return 2 + } +} describe('Translator', () => { describe('translate', () => {