diff --git a/css/grid.css b/css/grid.css index caaef192..05d6f619 100644 --- a/css/grid.css +++ b/css/grid.css @@ -193,3 +193,29 @@ div.data-table-cell-content-numeric > a.data-table-cell-edit { .recline-read-only a.row-header-menu { display: none; } + +/************************* + * WCAG 2.0 + *************************/ + +.wcag_hide { + position:absolute; + top:0; + left:-10000px; + width:1px; + height:1px; +} + +.wcag_hide2 { + clip: rect(1px, 1px, 1px, 1px); + display: block; + position: absolute; +} + +.wcag_show_on_focus { + font-size: 0 !important; +} + +.wcag_show_on_focus:focus { + font-size: 1em !important; +} diff --git a/demos/multiview/app.js b/demos/multiview/app.js index bfea4d28..c4cfece9 100755 --- a/demos/multiview/app.js +++ b/demos/multiview/app.js @@ -110,6 +110,7 @@ var createMultiView = function(dataset, state) { model: dataset, el: $el, state: state, + locale: 'pl', views: views }); return multiView; diff --git a/package.json b/package.json index 27c039bf..940dca70 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,10 @@ { "name": "Max Ogden", "email": "max@maxogden.com" + }, + { + "name": "Krzysztof Madejski", + "email": "krzysztof.madejski@epf.org.pl" } ], "dependencies": { diff --git a/src/i18n/en.js b/src/i18n/en.js new file mode 100644 index 00000000..baf523fe --- /dev/null +++ b/src/i18n/en.js @@ -0,0 +1,18 @@ +this.recline = this.recline || {}; +this.recline.View = this.recline.View || {}; +this.recline.View.translations = this.recline.View.translations || {}; + +this.recline.View.translations['en'] = { + 'date_required': "A date is required, check field field-date-format", + 'backend_error': 'There was an error querying the backend', + 'Distance_km': 'Distance (km)' +} + +// +//(function(v) { +// "use strict"; +// +// +// +//})(recline.t); +// diff --git a/src/i18n/pl.js b/src/i18n/pl.js index 2bbeef6a..e5bc1daa 100644 --- a/src/i18n/pl.js +++ b/src/i18n/pl.js @@ -4,7 +4,39 @@ this.recline.View.translations = this.recline.View.translations || {}; this.recline.View.translations['pl'] = { 'Grid': 'Tabela', + 'Graph': 'Wykres', + 'Map': 'Mapa', + 'Timeline': 'Oś czasu', + 'Search_data': 'Wyszukaj w danych', + 'Go': 'Szukaj', + 'Add': 'Dodaj', + 'Add_row': 'Dodaj wiersz', + 'Delete_row': 'Usuń wiersz', + 'Update': 'Zaktualizuj', + 'Cancel': 'Anuluj', + 'Filters': 'Filtry', + 'Add_filter': 'Dodaj filtr', + 'Remove_this_filter': 'Usuń filtr', + 'Fields': 'Kolumny', + 'Field': 'Kolumna', + 'Filter_type': 'Typ filtra', + 'Value': 'Wartość', + 'Range': 'Zakres', + 'Geo_distance': 'Odległość', + 'From': 'Od', + 'To': 'Do', + 'Longitude': 'Długość geograficzna', + 'Latitude': 'Szerokość geograficzna', + 'Distance_km': 'Odległość (km)', + 'backend_error': 'Wystąpił błąd połączenia z serwerem', + 'Unknown': '???', + 'Edit_this_cell': 'Edytuj komórkę', + 'date_required': "Data jest wymagana: sprawdź kolumnę field-date-format", + 'Show_field': 'Pokaż kolumnę', + 'Force_fit_columns': 'Dopasuj kolumny do zawartości', + 'Expand_and_collapse': 'Rozwiń i zwiń', + 'num_records': '{recordCount} rekordów' } // diff --git a/src/i18n/view.i18n.js b/src/i18n/view.i18n.js index c20d123d..065850e5 100644 --- a/src/i18n/view.i18n.js +++ b/src/i18n/view.i18n.js @@ -6,6 +6,7 @@ //_.extend(my.View, Backbone.I18nView); Backbone.I18nView = Backbone.View.extend({ + defaultLocale: 'en', locale: 'en', initializeI18n: function(locale) { this.locale = locale; @@ -24,10 +25,12 @@ Backbone.I18nView = Backbone.View.extend({ // fallback to key or default message if no translation is defined if (msg == null) { - console.warn("Missing locale for " + this.locale + "." + key); // TODO when dfault set and it's default locale then be quiet + if (this.locale != this.defaultLocale) { + console.warn("Missing locale for " + this.locale + "." + key); + } msg = defaultMessage; } - if (msg == null) { msg = key; } + if (msg == null) { msg = key; } // TODO w domyślnym locale automatycznie usuwaj podkreślenia // TODO i18n documentation @@ -37,36 +40,28 @@ Backbone.I18nView = Backbone.View.extend({ return formatted; } catch (e) { - console.error("Got error while formatting \"" + msg + "\": " + e.message); - // todo {{ wywala Message format, trzeba by wyescapować i pwrzywrócic po podmianie + var err = "Got error while formatting \"" + msg + "\": " + e.message; + if (e.name == 'SyntaxError' && e.found == '{') { + err += '. Probably you should change double brackets around variables (Mustache style) to single brackets (Intl style).'; + } + console.error(err); + return msg; } - - // TODO document below error (most probable variables ref hasn't ben changed in template) - /* 19:10:40.954 SyntaxError: