From e50417823971375a218376f685b7645d52f83d92 Mon Sep 17 00:00:00 2001 From: Kartik Visweswaran Date: Tue, 17 Mar 2015 22:24:13 +0530 Subject: [PATCH] Updates to v1.0.1 fixes #21 --- CHANGE.md | 13 ++++++++++++- FileInput.php | 37 ++++++++++++++++++++----------------- FileInputAsset.php | 4 ++-- LICENSE.md | 2 +- README.md | 2 +- messages/ar/fileinput.php | 5 +---- messages/da/fileinput.php | 7 ++----- messages/de/fileinput.php | 7 ++----- messages/en/fileinput.php | 7 ++----- messages/es/fileinput.php | 7 ++----- messages/fr/fileinput.php | 7 ++----- messages/hr/fileinput.php | 7 ++----- messages/hu/fileinput.php | 7 ++----- messages/it/fileinput.php | 7 ++----- messages/nl/fileinput.php | 7 ++----- messages/pl/fileinput.php | 7 ++----- messages/pt/fileinput.php | 7 ++----- messages/ru/fileinput.php | 7 ++----- messages/tr/fileinput.php | 7 ++----- 19 files changed, 63 insertions(+), 91 deletions(-) diff --git a/CHANGE.md b/CHANGE.md index c5bf6a1..fb1339f 100644 --- a/CHANGE.md +++ b/CHANGE.md @@ -1,7 +1,18 @@ +version 1.0.1 +============= + +**Date:** 17-Mar-2015 + +- (enh #4): Hungarian translations +- (enh #20): Croatian translations +- (enh #21): Updates to widget for v4.1.8 bootstrap-fileinput plugin + - All plugin related translations now reside in the [locales files in the plugin folder](http://github.com/kartik-v/bootstrap-fileinput/js). Pull requests for new translations or editing translations needs to be done in the plugin folder. + - The `language` property can be set at the widget level to set the language (this will default to `Yii::$app->language`). + version 1.0.0 ============= **Date:** 08-Nov-2014 - Initial release -- Sub repo split from [yii2-widgets](https://github.com/kartik-v/yii2-widgets) \ No newline at end of file +- Sub repo split from [yii2-widgets](https://github.com/kartik-v/yii2-widgets) diff --git a/FileInput.php b/FileInput.php index 71fef1d..098a35c 100644 --- a/FileInput.php +++ b/FileInput.php @@ -1,10 +1,10 @@
{$content}"; } - + /** - * Set the default plugin option - * - * @param string $key the array key in [[pluginOptions]] - * @param string $value the value for the key in [[pluginOptions]] + * Registers the asset bundle and locale */ - private function setPluginDefault($key, $value) - { - if (empty($this->pluginOptions[$key])) { - $this->pluginOptions[$key] = $value; + protected function registerAssetBundle() { + $view = $this->getView(); + if (!empty($this->language) && substr($this->language, 0, 2) != 'en') { + $path = Yii::getAlias('@vendor/kartik-v/bootstrap-fileinput/js'); + $file = "fileinput_locale_{$this->language}.js"; + if (!Config::fileExists("{$path}/{$file}")) { + $file = "fileinput_locale_{$this->_lang}.js"; + } + if (Config::fileExists("{$path}/{$file}")) { + FileInputAsset::register($view)->js[] = 'js/' . $file; + return; + } } + FileInputAsset::register($view); } - + /** * Registers the needed assets */ public function registerAssets() { $view = $this->getView(); - FileInputAsset::register($view); - - $this->setPluginDefault('browseLabel', Yii::t('fileinput', 'Browse') . '…'); - $this->setPluginDefault('uploadLabel', Yii::t('fileinput', 'Upload')); - $this->setPluginDefault('removeLabel', Yii::t('fileinput', 'Remove')); + $this->registerAssetBundle(); $this->registerPlugin('fileinput'); } } diff --git a/FileInputAsset.php b/FileInputAsset.php index d6dbafa..0accf80 100644 --- a/FileInputAsset.php +++ b/FileInputAsset.php @@ -1,10 +1,10 @@ NOTE: The latest version of the module is v1.0.0 released on 08-Nov-2014. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-widget-fileinput/blob/master/CHANGE.md) for details. +> NOTE: The latest version of the module is v1.0.1 released on 17-Mar-2015. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-widget-fileinput/blob/master/CHANGE.md) for details. ## Demo diff --git a/messages/ar/fileinput.php b/messages/ar/fileinput.php index e9b13d1..9cc4493 100644 --- a/messages/ar/fileinput.php +++ b/messages/ar/fileinput.php @@ -20,8 +20,5 @@ 'Note:' => 'ملاحظة:', 'multiple file upload' => 'متعددة تحميل الملف', 'file preview and multiple file upload' => 'ملف المعاينة ومتعددة تحميل الملف', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'متصفحك لا يدعم {validation}. تجربة أي بديل أو أكثر متصفح الأخيرة للوصول إلى هذه الميزات.', - 'Browse' => 'تصفح', - 'Remove' => 'نزع', - 'Upload' => 'تحميل', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'متصفحك لا يدعم {validation}. تجربة أي بديل أو أكثر متصفح الأخيرة للوصول إلى هذه الميزات.' ]; diff --git a/messages/da/fileinput.php b/messages/da/fileinput.php index 3b215fe..906a1a4 100644 --- a/messages/da/fileinput.php +++ b/messages/da/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'fil forhåndsvisning og multi fil upload', 'Note:' => 'Bemærk:', 'multiple file upload' => 'multi fil upload', - 'file preview and multiple file upload' => 'fil forhåndsvisning og multi fil upload', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Din browser supporterer ikke {validation}. Prøv en alternativ eller nyere browser for at bruge disse funktioner.', - 'Browse' => 'Gennemse', - 'Remove' => 'Fjern', - 'Upload' => 'Upload', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Din browser supporterer ikke {validation}. Prøv en alternativ eller nyere browser for at bruge disse funktioner.' ]; diff --git a/messages/de/fileinput.php b/messages/de/fileinput.php index 6f28be0..3f665fb 100644 --- a/messages/de/fileinput.php +++ b/messages/de/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'Datei-Vorschau und Hochladen mehrerer Dateien', 'Note:' => 'Hinweis:', 'multiple file upload' => 'Hochladen mehrerer Dateien', - 'file preview and multiple file upload' => 'Datei-Vorschau und Hochladen mehrerer Dateien', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Ihr Browser unterstützt keine {validation}. Versuchen Sie, eine alternative oder neueren Browser, um diese Funktionen zugreifen.', - 'Browse' => 'blättern', - 'Remove' => 'entfernen', - 'Upload' => 'laden', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Ihr Browser unterstützt keine {validation}. Versuchen Sie, eine alternative oder neueren Browser, um diese Funktionen zugreifen.' ]; diff --git a/messages/en/fileinput.php b/messages/en/fileinput.php index 3935c52..9d9c8d1 100644 --- a/messages/en/fileinput.php +++ b/messages/en/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => '', 'Note:' => '', 'multiple file upload' => '', - 'file preview and multiple file upload' => '', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => '', - 'Browse' => '', - 'Remove' => '', - 'Upload' => '', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => '' ]; diff --git a/messages/es/fileinput.php b/messages/es/fileinput.php index 5112e7a..e55a454 100644 --- a/messages/es/fileinput.php +++ b/messages/es/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'Vista previa de archivos y carga de varios archivos', 'Note:' => 'Nota:', 'multiple file upload' => 'carga de varios archivos', - 'file preview and multiple file upload' => 'Vista previa de archivos y carga de varios archivos', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Su navegador no soporta la {validation}. Pruebe una alternativa o explorador más reciente para acceder a estas funciones.', - 'Browse' => 'Navegar', - 'Remove' => 'eliminar', - 'Upload' => 'subir', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Su navegador no soporta la {validation}. Pruebe una alternativa o explorador más reciente para acceder a estas funciones.' ]; diff --git a/messages/fr/fileinput.php b/messages/fr/fileinput.php index 365b67c..82d4e42 100644 --- a/messages/fr/fileinput.php +++ b/messages/fr/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'Prévisualisation et dépôt de fichiers multiples', 'Note:' => 'Remarque :', 'multiple file upload' => 'Dépôt de fichiers multiples', - 'file preview and multiple file upload' => 'Prévisualisation et dépôt de fichiers multiples', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Votre navigateur ne supporte pas les {validation}. Essayez un navigateur alternatif ou plus récent pour accéder à ces fonctions.', - 'Browse' => 'Parcourir', - 'Remove' => 'Supprimer', - 'Upload' => 'Déposer', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Votre navigateur ne supporte pas les {validation}. Essayez un navigateur alternatif ou plus récent pour accéder à ces fonctions.' ]; diff --git a/messages/hr/fileinput.php b/messages/hr/fileinput.php index 2ae3270..6e31409 100644 --- a/messages/hr/fileinput.php +++ b/messages/hr/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'pregled datoteka i višestruko spremanje datoteka', 'Note:' => 'Bilješka:', 'multiple file upload' => 'višestruko spremanje datoteka', - 'file preview and multiple file upload' => 'pregled datoteka i višestruko spremanje datoteka', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Vaš internet preglednik ne podupire {validation}. Pokušajte sa novijom verzijom internet preglednika.', - 'Browse' => 'Odaberi', - 'Remove' => 'Ukloni', - 'Upload' => 'Snimi na server', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Vaš internet preglednik ne podupire {validation}. Pokušajte sa novijom verzijom internet preglednika.' ]; diff --git a/messages/hu/fileinput.php b/messages/hu/fileinput.php index f80b675..8998838 100644 --- a/messages/hu/fileinput.php +++ b/messages/hu/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'fájl előnézet és multi fájlfeltöltés', 'Note:' => 'Jegyzet:', 'multiple file upload' => 'multi fájlfeltöltés', - 'file preview and multiple file upload' => 'fájl előnézet és multi fájlfeltöltés', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'A böngészője sajnos nem támogatja {validation}. Kérem frissítse a jelenlegit vagy válasszon alternatív böngészőt.', - 'Browse' => 'Tallózás', - 'Remove' => 'Eltávolítás', - 'Upload' => 'Törlés', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'A böngészője sajnos nem támogatja {validation}. Kérem frissítse a jelenlegit vagy válasszon alternatív böngészőt.' ]; diff --git a/messages/it/fileinput.php b/messages/it/fileinput.php index e6aad32..e0eb71f 100644 --- a/messages/it/fileinput.php +++ b/messages/it/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'anteprima file e caricamento file multipli', 'Note:' => 'Note', 'multiple file upload' => 'caricamento file multipli', - 'file preview and multiple file upload' => 'anteprima file e caricamento file multipli', - 'Browse' => 'Scegli', - 'Upload' => 'Carica', - 'Remove' => 'Rimuovi', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Il tuo browser non supporta {validation}. Provane uno alternativo o una versione aggiornata per accedere a questa caratteristica', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Il tuo browser non supporta {validation}. Provane uno alternativo o una versione aggiornata per accedere a questa caratteristica' ]; diff --git a/messages/nl/fileinput.php b/messages/nl/fileinput.php index 8263cad..f95287e 100644 --- a/messages/nl/fileinput.php +++ b/messages/nl/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'bestand preview en uploaden meerdere bestanden', 'Note:' => 'Opmerking:', 'multiple file upload' => 'uploaden meerdere bestanden', - 'file preview and multiple file upload' => 'bestand preview en uploaden meerdere bestanden', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Uw browser ondersteunt geen {validation}. Probeer een andere of nieuwere browser om deze functies te gebruiken.', - 'Browse' => 'Bladeren', - 'Remove' => 'Verwijderen', - 'Upload' => 'Upload', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Uw browser ondersteunt geen {validation}. Probeer een andere of nieuwere browser om deze functies te gebruiken.' ]; diff --git a/messages/pl/fileinput.php b/messages/pl/fileinput.php index 5bf847f..c8ae442 100644 --- a/messages/pl/fileinput.php +++ b/messages/pl/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'podglądu i przesyłania wielu plików jednocześnie', 'Note:' => 'Wskazówka:', 'multiple file upload' => 'przesyłania wielu plików jednocześnie', - 'file preview and multiple file upload' => 'podglądu i przesyłania wielu plików jednocześnie', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Twoja przeglądarka nie wspiera {validation}. Wypróbuj innej lub nowszej przeglądarki, aby móc skorzystać z tych udogodnień.', - 'Browse' => 'Wybierz', - 'Remove' => 'Usuń', - 'Upload' => 'Wyślij', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Twoja przeglądarka nie wspiera {validation}. Wypróbuj innej lub nowszej przeglądarki, aby móc skorzystać z tych udogodnień.' ]; diff --git a/messages/pt/fileinput.php b/messages/pt/fileinput.php index 80a37e5..641f7e0 100644 --- a/messages/pt/fileinput.php +++ b/messages/pt/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'pré-visualização e upload de múltiplos arquivos', 'Note:' => 'Nota:', 'multiple file upload' => 'upload de múltiplos arquivos', - 'file preview and multiple file upload' => 'pré-visualização e upload de múltiplos arquivos', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Seu navegador não suporta {validation}. Teste em outro navegador mais atualizado.', - 'Browse' => 'Procurar', - 'Remove' => 'Remover', - 'Upload' => 'Upload', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Seu navegador não suporta {validation}. Teste em outro navegador mais atualizado.' ]; diff --git a/messages/ru/fileinput.php b/messages/ru/fileinput.php index 0f199d0..621110d 100644 --- a/messages/ru/fileinput.php +++ b/messages/ru/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'предварительный просмотр и множественную загрузку файлов', 'Note:' => 'Примечание:', 'multiple file upload' => 'множественную загрузку файлов', - 'file preview and multiple file upload' => 'предварительный просмотр и множественную загрузку файлов', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Ваш браузер не поддерживает {validation}. Попробуйте более новую версию или другой браузер, чтобы получить доступ к этим функциям.', - 'Browse' => 'Выбрать', - 'Remove' => 'Удалить', - 'Upload' => 'Загрузить', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Ваш браузер не поддерживает {validation}. Попробуйте более новую версию или другой браузер, чтобы получить доступ к этим функциям.' ]; diff --git a/messages/tr/fileinput.php b/messages/tr/fileinput.php index 8baf37f..fee6433 100644 --- a/messages/tr/fileinput.php +++ b/messages/tr/fileinput.php @@ -17,11 +17,8 @@ * NOTE: this file must be saved in UTF-8 encoding. */ return [ + 'file preview and multiple file upload' => 'önizle ve dosyaları yükle', 'Note:' => 'Not:', 'multiple file upload' => 'dosyaları yükle', - 'file preview and multiple file upload' => 'önizle ve dosyaları yükle', - 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Browserınız {validation} desteklemiyor. Bu özellikleri kullanabilmek için lütfen alternatif veya güncel bir browser ile bağlanın.', - 'Browse' => 'Gözat', - 'Remove' => 'Sil', - 'Upload' => 'Yükle', + 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.' => 'Browserınız {validation} desteklemiyor. Bu özellikleri kullanabilmek için lütfen alternatif veya güncel bir browser ile bağlanın.' ];