DGarvanski / angular-ui-grid-translate

An extension for angular-ui-grid, which allows the usage of angular-translate for i18n functionality (WIP)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

angular-ui-grid-translate

An extension for angular-ui-grid, which allows the usage of angular-translate for i18n functionality (WIP)

WORK IN PROGRESS, NOT FULLY FUNCTIONAL!

Demo on Plunker: DEMO

What it does

angular-ui-grid translate overrides the default [angular-ui-grid](http://ui-grid.info/) templates to allow translating grid elements with [angular-translate](https://angular-translate.github.io/), thus avoiding the need to configure both angular-translate and the ui-grid i18n service. The whole idea is to unify your apps internationalization into one configuration and give more flexibility to ui-grids i18n.

Why?

ui-grid is pretty limited in what it does with its localization. While it does provide a big array of available translations, it does require that you specifically configure the usage of the i18n service separately from your app internationalization if you're using [angular-translate](https://angular-translate.github.io/).

What works currently?

angular-ui-grid-translate currently works with a handful of languages and elements. It is not a full-fledged, finished project and doesn't translate every ui-grid element.

Elements:

  • Pagination
  • Footer
  • More to come...

Languages:

  • English (can be used as "en", "en_US", "en_GB")
  • French (can be used as "fr", "fr_FR")
  • German (can be used as "de", "de_DE")
  • Bulgarian (can be used as "bg", "bg_BG")
  • Russian (can be used as "ru", "ru_RU")
  • Czech (can be used as "cz", "cz_CZ")
  • Polish (can be used as "pl", "pl_PL")
  • Slovak (can be used as "sk", "sk_SK")
  • Spanish (can be used as "es", "es_ES")
  • Portuguese (can be used as "pt", "pt_PT", "pt_BR")
  • Italian (can be used as "it", "it_IT")
  • Romanian (can be used as "ro", "ro_RO")
  • Swedish (can be used as "sv", "sv_SE")
  • Finnish (can be used as "fi", "fi_FI")
  • Danish (can be used as "da", "da_DA")
  • Dutch (can be used as "nl", "nl_NL", "nl_BE")
  • Turkish (can be used as "tr", "tr_TR")
  • Tamil (can be used as "ta", "ta_IN")
  • Armenian (can be used as "hy", "hy_AM")
  • Japanese (can be used as "ja", "ja_JP")
  • Korean (can be used as "ko", "ko_KR")
  • More to come...

If you want to use it anyway

Installation

git clone http://github.com/DGarvanski/angular-ui-grid-translate/
or
bower install angular-ui-grid-translate --save
or
npm install angular-ui-grid-translate --save

Use

1.Add js file to your index.html:

<script src="angular-ui-grid-translate/js/angular-ui-grid-translate.js"></script>

or

<script src="bower_components/angular-ui-grid-translate/js/angular-ui-grid-translate.js"></script>

or

<script src="node_modules/angular-ui-grid-translate/js/angular-ui-grid-translate.js"></script>

NOTE: MUST BE ADDED AFTER THE UI-GRID IN THE INDEX


2.Declare as dependency: ``` angular.module('myApp',[ 'ui.grid', 'ui.grid.pagination', 'pascalprecht.translate', 'angular-ui-grid-translate' ]); ```
3.(optional) Use provided `'uigt.LanguageController'` to change the current language with `changeTo(language)`:

Example:

<div ng-controller="uigt.LanguageController">
    <div class="btn-group">
      <button class="btn btn-default btn-sm" ng-click="changeTo('en')">EN</button>
      <button class="btn btn-default btn-sm" ng-click="changeTo('bg')">BG</button>
    </div>
</div>

NOTE: YOU CAN JUST AS EASILY USE YOUR OWN METHOD.


4.See how your whole app gets translated on language change

Contributing

Feel free to contribute with anything from ui-grid templates to translations and doc improvements.

License

The MIT License (MIT)

Copyright (c) 2016 Dejan Garvanski

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

An extension for angular-ui-grid, which allows the usage of angular-translate for i18n functionality (WIP)

License:MIT License