improve user client side translations
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||||
// listed below.
|
// listed below.
|
||||||
//
|
// a
|
||||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||||
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
||||||
//
|
//
|
||||||
@@ -68,10 +68,13 @@ var $translations = {
|
|||||||
moved_to_another_table: 'The table is changed.',
|
moved_to_another_table: 'The table is changed.',
|
||||||
confirmation_title: 'Move to another table?',
|
confirmation_title: 'Move to another table?',
|
||||||
confirmation_body: 'Are you sure you want to move to another table?'
|
confirmation_body: 'Are you sure you want to move to another table?'
|
||||||
}
|
},
|
||||||
|
models: <%= I18n.t('activemodel.models', locale: :en).to_json %>,
|
||||||
|
attributes: <%= I18n.t('activemodel.attributes', locale: :en).to_json %>,
|
||||||
|
<%= I18n.t('user', locale: :en).to_json[1..-2] %>
|
||||||
},
|
},
|
||||||
nl: {
|
nl: {
|
||||||
messages: <%= I18n.t('messages', locale: :en).to_json %>,
|
messages: <%= I18n.t('messages', locale: :nl).to_json %>,
|
||||||
confirmations: {
|
confirmations: {
|
||||||
},
|
},
|
||||||
list_needs_help: {
|
list_needs_help: {
|
||||||
@@ -99,7 +102,10 @@ var $translations = {
|
|||||||
moved_to_another_table: 'De tafel is gewijzigd.',
|
moved_to_another_table: 'De tafel is gewijzigd.',
|
||||||
confirmation_title: 'Naar een andere tafel verhuizen?',
|
confirmation_title: 'Naar een andere tafel verhuizen?',
|
||||||
confirmation_body: 'Ben je aan een andere tafel gaan zitten?'
|
confirmation_body: 'Ben je aan een andere tafel gaan zitten?'
|
||||||
}
|
},
|
||||||
|
models: <%= I18n.t('activemodel.models', locale: :nl).to_json %>,
|
||||||
|
attributes: <%= I18n.t('activemodel.attributes', locale: :nl).to_json %>,
|
||||||
|
<%= I18n.t('user', locale: :nl).to_json[1..-2] %>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function redirect_to(mapping, variables){
|
function redirect_to(mapping, variables){
|
||||||
@@ -156,6 +162,7 @@ function getUrlVars() {
|
|||||||
return $url_vars;
|
return $url_vars;
|
||||||
}
|
}
|
||||||
$(function(){
|
$(function(){
|
||||||
|
$locale = QMobile.locale();
|
||||||
if(getUrlVars().message){
|
if(getUrlVars().message){
|
||||||
var container = $('.alert-success');
|
var container = $('.alert-success');
|
||||||
// Prepend messages. if there is no path/period specified
|
// Prepend messages. if there is no path/period specified
|
||||||
@@ -170,3 +177,8 @@ $(function(){
|
|||||||
}
|
}
|
||||||
$('[data-t]').each(function(){$(this).text(t($(this).attr('data-t')))})
|
$('[data-t]').each(function(){$(this).text(t($(this).attr('data-t')))})
|
||||||
});
|
});
|
||||||
|
function setLocale(locale){
|
||||||
|
QMobile.setLocale(locale);
|
||||||
|
$locale = locale;
|
||||||
|
$('[data-t]').each(function(){$(this).text(t($(this).attr('data-t')))})
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ html lang="en"
|
|||||||
var data_host = '#{Rails.env == 'development' ? 'http://localhost:3000' : 'http://data.qwaiter.com' }';
|
var data_host = '#{Rails.env == 'development' ? 'http://localhost:3000' : 'http://data.qwaiter.com' }';
|
||||||
//var data_host = 'http://localhost:3000';
|
//var data_host = 'http://localhost:3000';
|
||||||
//data_host = 'http://192.168.1.148:3000';
|
//data_host = 'http://192.168.1.148:3000';
|
||||||
var $locale = '#{I18n.locale}';
|
var $locale = 'en';
|
||||||
var $url_vars = null;
|
var $url_vars = null;
|
||||||
// Dummy holder when Qmobile object is not supplied by the mobile phone
|
// Dummy holder when Qmobile object is not supplied by the mobile phone
|
||||||
var QMobile, Qwaiter, Quser;
|
var QMobile, Qwaiter, Quser;
|
||||||
@@ -37,7 +37,9 @@ html lang="en"
|
|||||||
root_url: function(){return 'file:///Users/bterkuile/Documents/workspace/Qwaiter/assets'},
|
root_url: function(){return 'file:///Users/bterkuile/Documents/workspace/Qwaiter/assets'},
|
||||||
root_url: function(){return ''},
|
root_url: function(){return ''},
|
||||||
goHome: function(){ redirect_to('user_root')},
|
goHome: function(){ redirect_to('user_root')},
|
||||||
connection_problem: function(){alert('There is a problem connecting to the server')}
|
connection_problem: function(){alert('There is a problem connecting to the server')},
|
||||||
|
locale: function(){ return $locale || ($locale = 'en')},
|
||||||
|
setLocale: function(locale){$locale = locale; return locale}
|
||||||
});
|
});
|
||||||
//QMobile.setAuthToken('i5brDZ1HS1okoEq3pMyh');
|
//QMobile.setAuthToken('i5brDZ1HS1okoEq3pMyh');
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.page-header
|
.page-header
|
||||||
.table-number
|
.table-number
|
||||||
.supplier-name
|
.supplier-name
|
||||||
h4= t('user.active_list.title', list: List.model_name.human)
|
h4 data-t="active_list.title" = t('user.active_list.title', list: List.model_name.human)
|
||||||
.form-actions
|
.form-actions
|
||||||
= link_to t('helpers.links.place_order'), user_list_products_path, class: ['user-top-button'], id: 'place-order-on-list'
|
= link_to t('helpers.links.place_order'), user_list_products_path, class: ['user-top-button'], id: 'place-order-on-list'
|
||||||
span#list-needs-payment-button.user-top-button
|
span#list-needs-payment-button.user-top-button
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
table#active-list-table.table
|
table#active-list-table.table
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th= Order.model_name.human
|
th data-t="models.order" = Order.model_name.human
|
||||||
th.currency= Product.human_attribute_name(:price)
|
th.currency data-t="attributes.product.price" = Product.human_attribute_name(:price)
|
||||||
tbody
|
tbody
|
||||||
tr
|
tr
|
||||||
td colspan=2 = slider_image
|
td colspan=2 = slider_image
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
.page-header= title 'User list history'
|
.page-header
|
||||||
|
h2 data-t="list_history.title" = t('user.list_history.title')
|
||||||
nav.pagination
|
nav.pagination
|
||||||
ul#list-history-container
|
ul#list-history-container
|
||||||
- content_for :footer do
|
- content_for :footer do
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.page-header
|
.page-header
|
||||||
.table-number
|
.table-number
|
||||||
.supplier-name
|
.supplier-name
|
||||||
h4= t('user.show_products.title', products: Product.model_name.human_plural)
|
h4 data-t="show_products.title" = t('user.show_products.title', products: Product.model_name.human_plural)
|
||||||
.form-actions
|
.form-actions
|
||||||
= link_to t('helpers.links.show_active_list', list: List.model_name.human), user_active_list_path, class: ['user-top-button'], id: 'show-active-list'
|
= link_to t('helpers.links.show_active_list', list: List.model_name.human), user_active_list_path, class: ['user-top-button'], id: 'show-active-list'
|
||||||
span#list-needs-payment-button.user-top-button
|
span#list-needs-payment-button.user-top-button
|
||||||
@@ -14,9 +14,9 @@
|
|||||||
table#active-order-table.table.hide
|
table#active-order-table.table.hide
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th= Product.model_name.human
|
th data-t="models.product"= Product.model_name.human
|
||||||
th #
|
th #
|
||||||
th.currency Total
|
th.currency data-t="basket.total"= t('user.basket.total')
|
||||||
th
|
th
|
||||||
tbody
|
tbody
|
||||||
tfoot
|
tfoot
|
||||||
|
|||||||
@@ -108,10 +108,12 @@ en:
|
|||||||
|
|
||||||
user:
|
user:
|
||||||
active_list:
|
active_list:
|
||||||
title: Active %{list}
|
title: Active list
|
||||||
needs_payment: Check please!
|
needs_payment: Check please!
|
||||||
history_list:
|
history_list:
|
||||||
title: Closed %{list}
|
title: Closed list
|
||||||
|
list_history:
|
||||||
|
title: Closed lists
|
||||||
show_products:
|
show_products:
|
||||||
# The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products}
|
# The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products}
|
||||||
title: Menu
|
title: Menu
|
||||||
@@ -124,6 +126,8 @@ en:
|
|||||||
scan_qr: Scan qr code
|
scan_qr: Scan qr code
|
||||||
show_active_list: Show my orders
|
show_active_list: Show my orders
|
||||||
show_active_list_products: Go to the menu
|
show_active_list_products: Go to the menu
|
||||||
|
basket:
|
||||||
|
total: Total
|
||||||
section:
|
section:
|
||||||
first_section_title: Room
|
first_section_title: Room
|
||||||
manage_tables:
|
manage_tables:
|
||||||
|
|||||||
@@ -121,10 +121,12 @@ nl:
|
|||||||
|
|
||||||
user:
|
user:
|
||||||
active_list:
|
active_list:
|
||||||
title: Actieve %{list}
|
title: Actieve lijst
|
||||||
needs_payment: Rekening vragen!
|
needs_payment: Rekening vragen!
|
||||||
history_list:
|
history_list:
|
||||||
title: Afgesloten %{list}
|
title: Afgesloten lijst
|
||||||
|
list_history:
|
||||||
|
title: Afgesloten lijsten
|
||||||
show_products:
|
show_products:
|
||||||
# The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products}
|
# The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products}
|
||||||
title: Menu
|
title: Menu
|
||||||
@@ -137,6 +139,8 @@ nl:
|
|||||||
scan_qr: Scan qr code
|
scan_qr: Scan qr code
|
||||||
show_active_list: Toon mijn bestellingen
|
show_active_list: Toon mijn bestellingen
|
||||||
show_active_list_products: Ga naar het menu
|
show_active_list_products: Ga naar het menu
|
||||||
|
basket:
|
||||||
|
total: Totaal
|
||||||
section:
|
section:
|
||||||
first_section_title: Ruimte
|
first_section_title: Ruimte
|
||||||
manage_tables:
|
manage_tables:
|
||||||
|
|||||||
Reference in New Issue
Block a user