Improved i18n support.
This commit is contained in:
parent
368106d07b
commit
98458633a1
8 changed files with 142 additions and 97 deletions
|
@ -399,6 +399,10 @@ class App.Controller extends Spine.Controller
|
||||||
if row.callback
|
if row.callback
|
||||||
object[row.name]['name'] = row.callback(object[row.name]['name'])
|
object[row.name]['name'] = row.callback(object[row.name]['name'])
|
||||||
|
|
||||||
|
# check if translation is needed
|
||||||
|
if row.translate
|
||||||
|
object[row.name]['name'] = T( object[row.name]['name'] )
|
||||||
|
|
||||||
# @log 'table', 'header', header, 'overview', data_types, 'objects', objects
|
# @log 'table', 'header', header, 'overview', data_types, 'objects', objects
|
||||||
table = App.view('generic/table')(
|
table = App.view('generic/table')(
|
||||||
header: header,
|
header: header,
|
||||||
|
@ -430,8 +434,8 @@ class App.Controller extends Spine.Controller
|
||||||
{ name: 'number', link: true },
|
{ name: 'number', link: true },
|
||||||
{ name: 'title', link: true },
|
{ name: 'title', link: true },
|
||||||
{ name: 'customer', class: 'user-data', data: { id: true } },
|
{ name: 'customer', class: 'user-data', data: { id: true } },
|
||||||
{ name: 'ticket_state' },
|
{ name: 'ticket_state', translate: true },
|
||||||
{ name: 'ticket_priority' },
|
{ name: 'ticket_priority', translate: true },
|
||||||
{ name: 'group' },
|
{ name: 'group' },
|
||||||
{ name: 'owner', class: 'user-data', data: { id: true } },
|
{ name: 'owner', class: 'user-data', data: { id: true } },
|
||||||
{ name: 'created_at', callback: @humanTime },
|
{ name: 'created_at', callback: @humanTime },
|
||||||
|
@ -488,21 +492,21 @@ class App.Controller extends Spine.Controller
|
||||||
if diff >= 86400
|
if diff >= 86400
|
||||||
unit = Math.round( (diff / 86400) )
|
unit = Math.round( (diff / 86400) )
|
||||||
if unit > 1
|
if unit > 1
|
||||||
return unit + ' days'
|
return unit + ' ' + T('days')
|
||||||
else
|
else
|
||||||
return unit + ' day'
|
return unit + ' ' + T('day')
|
||||||
if diff >= 3600
|
if diff >= 3600
|
||||||
unit = Math.round( (diff / 3600) )
|
unit = Math.round( (diff / 3600) )
|
||||||
if unit > 1
|
if unit > 1
|
||||||
return unit + ' hours'
|
return unit + ' ' + T('hours')
|
||||||
else
|
else
|
||||||
return unit + ' hour'
|
return unit + ' ' + T('hour')
|
||||||
if diff <= 3600
|
if diff <= 3600
|
||||||
unit = Math.round( (diff / 60) )
|
unit = Math.round( (diff / 60) )
|
||||||
if unit > 1
|
if unit > 1
|
||||||
return unit + ' minutes'
|
return unit + ' ' + T('minutes')
|
||||||
else
|
else
|
||||||
return unit + ' minute'
|
return unit + ' ' + T('minute')
|
||||||
|
|
||||||
userInfo: (data) =>
|
userInfo: (data) =>
|
||||||
# start customer info controller
|
# start customer info controller
|
||||||
|
|
|
@ -149,7 +149,8 @@ class Index extends App.Controller
|
||||||
# notify UI
|
# notify UI
|
||||||
@notify
|
@notify
|
||||||
type: 'success',
|
type: 'success',
|
||||||
msg: "Ticket <a href=\"#ticket/zoom/#{r.id}\">#{r.number}</a> created!",
|
msg: T('Ticket %s created!', r.number),
|
||||||
|
link: "#ticket/zoom/#{r.id}"
|
||||||
timeout: 12000,
|
timeout: 12000,
|
||||||
|
|
||||||
# create new create screen
|
# create new create screen
|
||||||
|
|
|
@ -27,6 +27,8 @@ class App.Notify extends Spine.Controller
|
||||||
data['type'] = 'alert'
|
data['type'] = 'alert'
|
||||||
|
|
||||||
$.noty.closeAll()
|
$.noty.closeAll()
|
||||||
|
if data.link
|
||||||
|
data.msg = '<a href="' + data.link + '">' + data.msg + '</a>'
|
||||||
$('#notify').noty(
|
$('#notify').noty(
|
||||||
{
|
{
|
||||||
text: data.msg,
|
text: data.msg,
|
||||||
|
|
|
@ -141,12 +141,49 @@ class App.Auth extends App.Ajax
|
||||||
url: '/signout',
|
url: '/signout',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class App.i18n extends App.Ajax
|
||||||
|
# @include App.Ajax
|
||||||
|
|
||||||
|
constructor: ->
|
||||||
|
@set('de')
|
||||||
|
window.T = @translate
|
||||||
|
|
||||||
|
set: (locale) =>
|
||||||
|
@map = {}
|
||||||
|
@ajax(
|
||||||
|
type: 'GET',
|
||||||
|
url: '/' + locale + '.json',
|
||||||
|
async: false,
|
||||||
|
success: (data, status, xhr) =>
|
||||||
|
@map = data
|
||||||
|
error: (xhr, statusText, error) =>
|
||||||
|
console.log 'error', error, statusText, xhr.statusCode
|
||||||
|
)
|
||||||
|
|
||||||
|
translate: (string, args...) =>
|
||||||
|
|
||||||
|
# return translation
|
||||||
|
if @map[string] isnt undefined
|
||||||
|
translated = @map[string]
|
||||||
|
else
|
||||||
|
translated = string
|
||||||
|
|
||||||
|
# search %s
|
||||||
|
for arg in args
|
||||||
|
translated = translated.replace(/%s/, arg)
|
||||||
|
|
||||||
|
# return translated string
|
||||||
|
return translated
|
||||||
|
|
||||||
class App.Run extends Spine.Controller
|
class App.Run extends Spine.Controller
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
@log 'RUN app'#, @
|
@log 'RUN app'#, @
|
||||||
@el = $('#app')
|
@el = $('#app')
|
||||||
|
|
||||||
|
# init of i18n
|
||||||
|
new App.i18n
|
||||||
|
|
||||||
# start navigation controller
|
# start navigation controller
|
||||||
new App.Navigation( el: @el.find('#navigation') );
|
new App.Navigation( el: @el.find('#navigation') );
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<h1><%- @overview.meta.name %> <small><a href="#" data-type="settings" class="icon-edit"></a></small></h1>
|
<h1><%- T(@overview.meta.name) %> <small><a href="#" data-type="settings" class="icon-edit"></a></small></h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<div class="pagination keepright">
|
<div class="pagination keepright">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span3">
|
<div class="span3">
|
||||||
<h2><%= @T(@head) %></h2>
|
<h2><%= T(@head) %></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<% for item in @items: %>
|
<% for item in @items: %>
|
||||||
<li><a href="<%= item.link %>" title="<%= item.summary %>" target="_blank"><%= item.title %>"</a></li>
|
<li><a href="<%= item.link %>" title="<%= item.summary %>" target="_blank"><%= item.title %>"</a></li>
|
||||||
|
|
|
@ -6,89 +6,3 @@ Config.product_name = 'Zammad'
|
||||||
Config.requested_url = ''
|
Config.requested_url = ''
|
||||||
var Store = {};
|
var Store = {};
|
||||||
var Session = {};
|
var Session = {};
|
||||||
var Trans = {
|
|
||||||
'New': 'Neu',
|
|
||||||
'Create': 'Erstellen',
|
|
||||||
'Cancel': 'Abbrechen',
|
|
||||||
'Submit': 'Übermitteln',
|
|
||||||
'Sign out': 'Abmelden',
|
|
||||||
'Profile': 'Profil',
|
|
||||||
'Settings': 'Einstellungen',
|
|
||||||
'Overviews': 'Übersichten',
|
|
||||||
'Manage': 'Verwalten',
|
|
||||||
'Users': 'Benutzer',
|
|
||||||
'Groups': 'Gruppen',
|
|
||||||
'Group': 'Gruppe',
|
|
||||||
'Organizations': 'Organisationen',
|
|
||||||
'Organization': 'Organisation',
|
|
||||||
'Recent Viewed': 'Zuletzt angesehen',
|
|
||||||
'Security': 'Sicherheit',
|
|
||||||
'From': 'Von',
|
|
||||||
'Title': 'Titel',
|
|
||||||
'Customer': 'Kunde',
|
|
||||||
'State': 'Status',
|
|
||||||
'Created': 'Erstellt',
|
|
||||||
'Attributes': 'Attribute',
|
|
||||||
'Direction': 'Richtung',
|
|
||||||
'Owner': 'Besitzer',
|
|
||||||
'Subject': 'Betreff',
|
|
||||||
'Priority': 'Priorität',
|
|
||||||
'Select the customer of the Ticket or create one.': 'Wähle den Kunden eine Tickets oder erstell einen neuen.',
|
|
||||||
'New Ticket': 'Neues Ticket',
|
|
||||||
'Firstname': 'Vorname',
|
|
||||||
'Lastname': 'Nachname',
|
|
||||||
'Phone': 'Telefon',
|
|
||||||
'Street': 'Straße',
|
|
||||||
'Zip': 'PLZ',
|
|
||||||
'City': 'Stadt',
|
|
||||||
'Note': 'Notiz',
|
|
||||||
'note': 'Notiz',
|
|
||||||
'New User': 'Neuer Benutzer',
|
|
||||||
'new': 'neu',
|
|
||||||
'closed': 'geschlossen',
|
|
||||||
'open': 'offen',
|
|
||||||
'pending': 'warten',
|
|
||||||
'Activity Stream': 'Aktivitäts-Stream',
|
|
||||||
'updated': 'aktuallisierte',
|
|
||||||
'My assigned Tickets': 'Meine zugewisenen Tickets',
|
|
||||||
'Unassigned Tickets': 'Nicht zugewisene/freie Tickets',
|
|
||||||
'All Tickets': 'Alle Tickets',
|
|
||||||
'Escalated Tickets': 'Eskallierte Tickets',
|
|
||||||
'My pending reached Tickets': 'Meine warten erreicht Tickets',
|
|
||||||
'Password': 'Passwort',
|
|
||||||
'Password (confirm)': 'Passwort (bestätigen)',
|
|
||||||
'Roles': 'Rollen',
|
|
||||||
'Active': 'Aktiv',
|
|
||||||
'Edit': 'Bearbeiten',
|
|
||||||
'Base': 'Basis',
|
|
||||||
'Number': 'Nummer',
|
|
||||||
'Sender Format': 'Absender Format',
|
|
||||||
'Authentication': 'Authorisierung',
|
|
||||||
'Product Name': 'Produkt Name',
|
|
||||||
'To': 'An',
|
|
||||||
'Customer': 'Kunde',
|
|
||||||
'Linked Accounts': 'Verknüpfte Accounts',
|
|
||||||
'Sign in with': 'Anmelden mit',
|
|
||||||
'Username or email': 'Benutzer oder Email',
|
|
||||||
'Remember me': 'An mich erinnern',
|
|
||||||
'Forgot password?': 'Passwort vergessen?',
|
|
||||||
'Sign in using': 'Anmelden über',
|
|
||||||
'New to': 'Neu bei',
|
|
||||||
'join today!': 'werde Teil!',
|
|
||||||
'Sign up': 'Registrieren',
|
|
||||||
'Sign in': 'Anmelden',
|
|
||||||
'Create my account': 'Meinen Account erstellen',
|
|
||||||
'Login successfully! Have a nice day!': 'Anmeldung erfolgreich!',
|
|
||||||
'Last contact': 'Letzter Kontakt',
|
|
||||||
'Last contact (Agent)': 'Letzter Kontakt (Agent)',
|
|
||||||
'Last contact (Customer)': 'Letzter Kontakt (Kunde)',
|
|
||||||
'Close time': 'Schließzeit',
|
|
||||||
'First response': 'Erste Reaktion',
|
|
||||||
'': '',
|
|
||||||
}
|
|
||||||
var T = function(string) {
|
|
||||||
if ( Trans[string] !== undefined ) {
|
|
||||||
return Trans[string];
|
|
||||||
}
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
87
public/de.json
Normal file
87
public/de.json
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
{
|
||||||
|
"New": "Neu",
|
||||||
|
"Create": "Erstellen",
|
||||||
|
"Cancel": "Abbrechen",
|
||||||
|
"Submit": "Übermitteln",
|
||||||
|
"Sign out": "Abmelden",
|
||||||
|
"Profile": "Profil",
|
||||||
|
"Settings": "Einstellungen",
|
||||||
|
"Overviews": "Übersichten",
|
||||||
|
"Manage": "Verwalten",
|
||||||
|
"Users": "Benutzer",
|
||||||
|
"Groups": "Gruppen",
|
||||||
|
"Group": "Gruppe",
|
||||||
|
"Organizations": "Organisationen",
|
||||||
|
"Organization": "Organisation",
|
||||||
|
"Recent Viewed": "Zuletzt angesehen",
|
||||||
|
"Security": "Sicherheit",
|
||||||
|
"From": "Von",
|
||||||
|
"Title": "Titel",
|
||||||
|
"Customer": "Kunde",
|
||||||
|
"State": "Status",
|
||||||
|
"Created": "Erstellt",
|
||||||
|
"Attributes": "Attribute",
|
||||||
|
"Direction": "Richtung",
|
||||||
|
"Owner": "Besitzer",
|
||||||
|
"Subject": "Betreff",
|
||||||
|
"Priority": "Priorität",
|
||||||
|
"Select the customer of the Ticket or create one.": "Wähle den Kunden eine Tickets oder erstell einen neuen.",
|
||||||
|
"New Ticket": "Neues Ticket",
|
||||||
|
"Firstname": "Vorname",
|
||||||
|
"Lastname": "Nachname",
|
||||||
|
"Phone": "Telefon",
|
||||||
|
"Street": "Straße",
|
||||||
|
"Zip": "PLZ",
|
||||||
|
"City": "Stadt",
|
||||||
|
"Note": "Notiz",
|
||||||
|
"note": "Notiz",
|
||||||
|
"New User": "Neuer Benutzer",
|
||||||
|
"new": "neu",
|
||||||
|
"closed": "geschlossen",
|
||||||
|
"open": "offen",
|
||||||
|
"pending": "warten",
|
||||||
|
"Activity Stream": "Aktivitäts-Stream",
|
||||||
|
"updated": "aktuallisierte",
|
||||||
|
"My assigned Tickets": "Meine zugewisenen Tickets",
|
||||||
|
"Unassigned Tickets": "Nicht zugewisene/freie Tickets",
|
||||||
|
"All Tickets": "Alle Tickets",
|
||||||
|
"Escalated Tickets": "Eskallierte Tickets",
|
||||||
|
"My pending reached Tickets": "Meine warten erreicht Tickets",
|
||||||
|
"Password": "Passwort",
|
||||||
|
"Password (confirm)": "Passwort (bestätigen)",
|
||||||
|
"Roles": "Rollen",
|
||||||
|
"Active": "Aktiv",
|
||||||
|
"Edit": "Bearbeiten",
|
||||||
|
"Base": "Basis",
|
||||||
|
"Number": "Nummer",
|
||||||
|
"Sender Format": "Absender Format",
|
||||||
|
"Authentication": "Authorisierung",
|
||||||
|
"Product Name": "Produkt Name",
|
||||||
|
"To": "An",
|
||||||
|
"Customer": "Kunde",
|
||||||
|
"Linked Accounts": "Verknüpfte Accounts",
|
||||||
|
"Sign in with": "Anmelden mit",
|
||||||
|
"Username or email": "Benutzer oder Email",
|
||||||
|
"Remember me": "An mich erinnern",
|
||||||
|
"Forgot password?": "Passwort vergessen?",
|
||||||
|
"Sign in using": "Anmelden über",
|
||||||
|
"New to": "Neu bei",
|
||||||
|
"join today!": "werde Teil!",
|
||||||
|
"Sign up": "Registrieren",
|
||||||
|
"Sign in": "Anmelden",
|
||||||
|
"Create my account": "Meinen Account erstellen",
|
||||||
|
"Login successfully! Have a nice day!": "Anmeldung erfolgreich!",
|
||||||
|
"Last contact": "Letzter Kontakt",
|
||||||
|
"Last contact (Agent)": "Letzter Kontakt (Agent)",
|
||||||
|
"Last contact (Customer)": "Letzter Kontakt (Kunde)",
|
||||||
|
"Close time": "Schließzeit",
|
||||||
|
"First response": "Erste Reaktion",
|
||||||
|
"Ticket %s created!": "Ticket %s erstellt!",
|
||||||
|
"day": "Tag",
|
||||||
|
"days": "Tage",
|
||||||
|
"hour": "Stunde",
|
||||||
|
"hours": "Stunden",
|
||||||
|
"minute": "Minute",
|
||||||
|
"minutes": "Minuten",
|
||||||
|
"": ""
|
||||||
|
}
|
Loading…
Reference in a new issue