Init version of i18n.

This commit is contained in:
Martin Edenhofer 2012-04-30 19:55:25 +02:00
parent d147aedde6
commit df1493fb81
22 changed files with 144 additions and 74 deletions

View file

@ -163,9 +163,12 @@ class App.Controller extends Spine.Controller
if name
name = name + ' '
name = name + item.lastname
name_new = name
if attribute.translate
name_new = T(name)
attribute.options.push {
name: name,
name: name_new,
value: item.id,
note: item.note,
}

View file

@ -3,9 +3,9 @@ $ = jQuery.sub()
class Index extends App.Controller
events:
'click .customer_new': 'user_new'
'submit form': 'submit',
'click .submit': 'submit',
'click .cancel': 'cancel',
'submit form': 'submit',
'click .submit': 'submit',
'click .cancel': 'cancel',
constructor: ->
super
@ -68,8 +68,8 @@ class Index extends App.Controller
{ name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, filter: @edit_form, nulloption: true, relation: 'User', default: defaults['owner_id'], class: 'span7', },
{ name: 'subject', display: 'Subject', tag: 'input', type: 'text', limit: 100, null: false, default: defaults['subject'], class: 'span7', },
{ name: 'body', display: 'Text', tag: 'textarea', rows: 6, null: false, default: defaults['body'], class: 'span7', },
{ name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketState', default: defaults['ticket_state_id'], class: 'medium' },
{ name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketPriority', default: defaults['ticket_priority_id'], class: 'medium' },
{ name: 'ticket_state_id', display: 'State', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketState', default: defaults['ticket_state_id'], translate: true, class: 'medium' },
{ name: 'ticket_priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, filter: @edit_form, relation: 'TicketPriority', default: defaults['ticket_priority_id'], translate: true, class: 'medium' },
]
@html App.view('agent_ticket_create')(
head: 'New Ticket',
@ -188,7 +188,7 @@ class UserNew extends App.ControllerModal
user = new App.User
# find role_id
role = App.Role.findByAttribute("name", "Customer")
role = App.Role.findByAttribute( 'name', 'Customer' )
params.role_ids = role.id
@log 'updateAttributes', params
user.load(params)

View file

@ -176,7 +176,7 @@ class App.Navigation extends App.Controller
Config.NavBar['TicketOverview' + item.url] = {
prio: item.prio,
parent: '#ticket/view',
name: item.name + ' (' + item.count + ')',
name: T(item.name) + ' (' + item.count + ')',
target: '#ticket/view/' + item.url,
role: ['Agent'],
}

View file

@ -11,11 +11,9 @@ class App.TemplateUI extends App.Controller
# fetch item on demand
fetch_needed = 1
# if App.User.exists(@user_id)
# @user = App.User.find(@user_id)
# @log 'exists', @user
# fetch_needed = 0
# @render()
if App.Template.count() > 0
fetch_needed = 0
@render()
if fetch_needed
@reload()
@ -50,9 +48,10 @@ class App.TemplateUI extends App.Controller
# get params
params = @formParam(e.target)
template = App.Template.find( params['template_id'] )
template.destroy()
@template_id = undefined
@render()
if confirm('Sure?')
template.destroy()
@template_id = undefined
@render()
select: (e) =>
e.preventDefault()

View file

@ -1,5 +1,5 @@
<div class="page-header">
<h1>New Ticket <small></small></h1>
<h1><%= T('New Ticket') %> <small></small></h1>
</div>
<form class="form-horizontal">
@ -16,6 +16,6 @@
</div>
</div>
<div class="form-actions">
<button type="reset" class="btn">Cancel</button>&nbsp;<input type="submit" class="btn btn-primary" value="Create"/>
<button type="reset" class="btn cancel"><%= T('Cancel') %></button>&nbsp;<button type="submit" class="btn btn-primary submit"><%= T('Create') %></button>
</div>
</form>

View file

@ -1,13 +1,13 @@
<form class="form-horizontal">
<div class="modal-header">
<a href="#" class="close">&times;</a>
<h3><%= @head %></h3>
<h3><%= T(@head) %></h3>
</div>
<div class="modal-body">
<%- @form %>
</div>
<div class="modal-footer">
<button class="btn btn-primary submit">Submit</button>
<button class="btn secondary cancel">Cancel</button>
<button class="btn btn-primary submit"><%= T('Submit') %></button>
<button class="btn secondary cancel"><%= T('Cancel') %></button>
</div>
</form>

View file

@ -1,10 +1,10 @@
<div class="row">
<div class="span3">
<h2><%= @head %></h2>
<h2><%= T(@head) %></h2>
<dl>
<% for item in @items: %>
<dt><span class="user-data" data-id="<%= item.created_by_id %>">"<%= item.created_by.realname %>"</span></dt>
<dd><%= item.history_type.name %> <span data-id="<%= item.o_id %>"><a data-type="edit" href="#"><%= item.history_object.name %> (<%= item.ticket.title %>)</a></span>.</dd>
<dd><%= T(item.history_type.name) %> <span data-id="<%= item.o_id %>"><a data-type="edit" href="#"><%= item.history_object.name %> (<%= item.ticket.title %>)</a></span>.</dd>
<% end %>
</dl>
</div>

View file

@ -1,6 +1,6 @@
<div class="row">
<div class="span3">
<h2><%= @head %></h2>
<h2><%= T(@head) %></h2>
<ul>
<% for item in @items: %>
<li><span data-id="<%= item.o_id %>"><a data-type="edit" href="#"><%= item.history_object.name %> (<%= item.ticket.title %>)</a></span></li>

View file

@ -1,6 +1,6 @@
<div class="row">
<div class="span3">
<h2><%= @head %></h2>
<h2><%= @T(@head) %></h2>
<ul>
<% for item in @items: %>
<li><a href="<%= item.link %>" title="<%= item.summary %>" target="_blank"><%= item.title %>"</a></li>

View file

@ -1,10 +1,10 @@
<div class="row">
<div class="span9">
<div class="row">
<div class="span4">
<h2><%= @overview.meta.name %> <small><a href="#" data-type="settings" class="icon-edit"></a></small></h2>
</div>
<div class="span5">
<h2><%= T(@overview.meta.name) %> <small><a href="#" data-type="settings" class="icon-edit"></a></small></h2>
</div>
<div class="span4">
<div class="pagination">
<ul>
<li>

View file

@ -1,6 +1,6 @@
<div class="modal-header">
<a href="#" class="close">&times;</a>
<h3>Edit: <%= @overview.meta.name %></h3>
<h3><%= T('Edit') %>: <%= T(@overview.meta.name) %></h3>
</div>
<div class="modal-body">
<form class="form-horizontal">
@ -8,6 +8,6 @@
</form>
</div>
<div class="modal-footer">
<button class="btn btn-primary submit">Submit</button>
<button class="btn cancel">Cancel</button>
<button class="btn btn-primary submit"><%= T('Submit') %></button>
<button class="btn cancel"><%= T('Cancel') %></button>
</div>

View file

@ -1,13 +1,13 @@
<form class="form-horizontal">
<div class="modal-header">
<a href="#" class="close">&times;</a>
<h3><%= @head %></h3>
<h3><%= T(@head) %></h3>
</div>
<div class="modal-body">
<%- @form %>
</div>
<div class="modal-footer">
<button class="btn btn-primary submit">Submit</button>
<button class="btn cancel">Cancel</button>
<button class="btn btn-primary submit"><%= T('Submit') %></button>
<button class="btn cancel"><%= T('Cancel') %></button>
</div>
</form>

View file

@ -1,5 +1,5 @@
<div class="page-header">
<h1><%= @head %> <small>Management</small></h1>
<h1><%= T(@head) %> <small><%= T('Management') %></small></h1>
</div>
<div class="row">
@ -23,12 +23,12 @@
</ul>
<% for note in @notes: %>
<p><%= note %></p>
<p><%= T(note) %></p>
<% end %>
<% if @buttons: %>
<% for button in @buttons: %>
<p><a data-type="<%= button['data-type'] %>" class="btn <%= button['class'] %>"><%= button.name %></a></p>
<p><a data-type="<%= button['data-type'] %>" class="btn <%= button['class'] %>"><%= T(button.name) %></a></p>
<% end %>
<% end %>

View file

@ -1,13 +1,13 @@
<form class="form-horizontal">
<div class="modal-header">
<a href="#" class="close">&times;</a>
<h3><%= @head %></h3>
<h3><%= T(@head) %></h3>
</div>
<div class="modal-body">
<%- @form %>
</div>
<div class="modal-footer">
<button class="btn btn-primary submit">Submit</button>
<button class="btn cancel">Cancel</button>
<button class="btn btn-primary submit"><%= T('Submit') %></button>
<button class="btn cancel"><%= T('Cancel') %></button>
</div>
</form>

View file

@ -1,5 +1,5 @@
<div class="page-header">
<h1><%= @page.head %> <small><%= @page.sub_head %></small></h1>
<h1><%= T(@page.head) %> <small><%= T(@page.sub_head) %></small></h1>
</div>
<div class="row">
@ -7,7 +7,7 @@
<ul class="nav nav-tabs nav-stacked">
<% if @menus: %>
<% for menu in @menus: %>
<li class="<%= menu['class'] %>"><a href="<%= @page.nav %>/<%= menu.target %>" data-toggle="tabnav" data-target="<%= menu['target'] %>" ><%= menu.name %></a></li>
<li class="<%= menu['class'] %>"><a href="<%= @page.nav %>/<%= menu.target %>" data-toggle="tabnav" data-target="<%= menu['target'] %>" ><%= T(menu.name) %></a></li>
<% end %>
<% end %>
</ul>

View file

@ -1,8 +1,8 @@
<div class="control-group <%= @attribute.item_class %>">
<label class="control-label" for="<%= @attribute.id %>"><%= @attribute.display %><% if !@attribute.null: %> *<% end %></label>
<label class="control-label" for="<%= @attribute.id %>"><%= T(@attribute.display) %><% if !@attribute.null: %> *<% end %></label>
<div class="controls">
<%- @item %>
<span class="help-inline"></span>
<span class="help-block"><%= @attribute.help %> <%- @attribute.link %></span>
<span class="help-block"><%= T(@attribute.help) %> <%- @attribute.link %></span>
</div>
</div>

View file

@ -5,7 +5,7 @@
<th><input type="checkbox" value="" name="bulk_all"/></th>
<% end %>
<% for row in @header: %>
<th><%= row %></th>
<th><%= T(row) %></th>
<% end %>
<!--
<th>Destory</th>

View file

@ -6,21 +6,21 @@
<% for item in @navbar_left: %>
<% if item.child: %>
<li class="dropdown">
<a href="<%= item.target %>" class="dropdown-toggle" data-toggle="dropdown"><%= item.name %> <b class="caret"></b></a>
<a href="<%= item.target %>" class="dropdown-toggle" data-toggle="dropdown"><%= T(item.name) %> <b class="caret"></b></a>
<ul class="dropdown-menu">
<% for item in item.child: %>
<% if item.divider: %>
<li class="divider"></li>
<% end %>
<% if item.navheader: %>
<li class="nav-header"><%= item.navheader %></li>
<li class="nav-header"><%= T(item.navheader) %></li>
<% end %>
<li><a href="<%= item.target %>"><%= item.name %></a></li>
<li><a href="<%= item.target %>"><%= T(item.name) %></a></li>
<% end %>
</ul>
</li>
<% else: %>
<li><a href="<%= item.target %>"><%= item.name %></a></li>
<li><a href="<%= item.target %>"><%= T(item.name) %></a></li>
<% end %>
<% end %>
</ul>
@ -32,27 +32,27 @@
<% for item in @navbar_right: %>
<% if item.child: %>
<li class="dropdown">
<a href="<%= item.target %>" class="dropdown-toggle" data-toggle="dropdown"><%= item.name %> <b class="caret"></b></a>
<a href="<%= item.target %>" class="dropdown-toggle" data-toggle="dropdown"><%= T(item.name) %> <b class="caret"></b></a>
<ul class="dropdown-menu">
<% for item in item.child: %>
<% if item.divider: %>
<li class="divider"></li>
<% end %>
<% if item.navheader: %>
<li class="nav-header"><%= item.navheader %></li>
<li class="nav-header"><%= T(item.navheader) %></li>
<% end %>
<li><a href="<%= item.target %>"><%= item.name %></a></li>
<li><a href="<%= item.target %>"><%= T(item.name) %></a></li>
<% end %>
</ul>
</li>
<% else: %>
<li><a href="<%= item.target %>"><%= item.name %></a></li>
<li><a href="<%= item.target %>"><%= T(item.name) %></a></li>
<% end %>
<% end %>
</ul>
<% else: %>
<ul class="nav pull-right">
<li><a href="#login">Sign in</a></li>
<li><a href="#login"><%= T('Sign in') %></a></li>
</ul>
<% end %>
</div>

View file

@ -1,7 +1,7 @@
<form class="">
<h2><%= @setting.title %></h2>
<p><%= @setting.description %></p>
<h2><%= T(@setting.title) %></h2>
<p><%= T(@setting.description) %></p>
<%- @form %>
<input type="submit" class="btn" value="Submit"/>
<button type="submit" class="btn"><%= T('Submit') %></button>
</form>
<hr/>

View file

@ -1,19 +1,19 @@
<div class="well">
<h3>Customer</h3>
<h3><%= T('Customer') %></h3>
<% if @user.image: %>
<img class="thumbnail" src="<%- @user.image %>" alt="">
<% end %>
<div class="row">
<div class="customer-info" title="Name"><%= @user['realname'] %></div>
<div class="customer-info" title="<%= T('Name') %>"><%= @user['realname'] %></div>
</div>
<% for row in @data: %>
<% if @user[row.name] || row.name is 'note': %>
<div class="row">
<% if row.tag isnt 'textarea': %>
<div class="customer-info" title="<%= row.display %>"><%- window.linkify( @user[row.name] ) %></div>
<div class="customer-info" title="<%= T(row.display) %>"><%- window.linkify( @user[row.name] ) %></div>
<% else: %>
<div class="customer-info" title="<%= row.display %>">
<strong><%= row.display %></strong><br/>
<div class="customer-info" title="<%= T(row.display) %>">
<strong><%= T(row.display) %></strong><br/>
<textarea class="customer-info" rows="3" name="<%= row.name %>" data-type=edit><%= @user[row.name] %></textarea>
</div>
<% end %>
@ -23,7 +23,7 @@
<% if !_.isEmpty(@user['accounts']): %>
<div class="row">
<div class="customer-info">
<strong>Linked Accounts</strong><br/>
<strong><%= T('Linked Accounts') %></strong><br/>
<% for account of @user['accounts']: %>
<a href="<%= @user['accounts'][account]['link'] %>" target="_blank"><%= account %></a>
<% end %>
@ -34,14 +34,14 @@
<% for link in @user['links']: %>
<div class="row">
<div class="customer-info">
<strong><%= link['title'] %></strong><br/>
<strong><%= T(link['title']) %></strong><br/>
<% for item in link['items']: %>
<% if item['url']: %>
<a href="<%= item['url'] %>" title="<%= item['title'] %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>" <% if link.new_window: %>target="_blank"<% end %>>
<a href="<%= item['url'] %>" title="<%= T(item['title']) %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>" <% if link.new_window: %>target="_blank"<% end %>>
<% else: %>
<span title="<%= item['title'] %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>">
<span title="<%= T(item['title']) %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>">
<% end %>
<%= item['name'] %>
<%= T(item['name']) %>
<% if item['url']: %>
</a>
<% else: %>

View file

@ -1,14 +1,14 @@
<% for row in @data: %>
<% if @user[row.name]: %>
<div class="row">
<div class="customer-info" title="<%= row.display %>"><%- window.linkify( @user[row.name] ) %></div>
<div class="customer-info" title="<%= T(row.display) %>"><%- window.linkify( @user[row.name] ) %></div>
</div>
<% end %>
<% end %>
<% if !_.isEmpty(@user['accounts']): %>
<div class="row">
<div class="customer-info">
<strong>Linked Accounts</strong><br/>
<strong><%= T('Linked Accounts') %></strong><br/>
<% for account of @user['accounts']: %>
<a href="<%= @user['accounts'][account]['link'] %>" target="_blank"><%= account %></a>
<% end %>
@ -19,14 +19,14 @@
<% for link in @user['links']: %>
<div class="row">
<div class="customer-info">
<strong><%= link['title'] %></strong><br/>
<strong><%= T(link['title']) %></strong><br/>
<% for item in link['items']: %>
<% if item['url']: %>
<a href="<%= item['url'] %>" title="<%= item['title'] %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>" <% if link.new_window: %>target="_blank"<% end %>>
<a href="<%= item['url'] %>" title="<%= T(item['title']) %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>" <% if link.new_window: %>target="_blank"<% end %>>
<% else: %>
<span title="<%= item['title'] %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>">
<span title="<%= T(item['title']) %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>">
<% end %>
<%= item['name'] %>
<%= T(item['name']) %>
<% if item['url']: %>
</a>
<% else: %>

View file

@ -6,3 +6,71 @@ Config.product_name = 'Zammad'
Config.requested_url = ''
var Store = {};
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',
'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',
}
var T = function(string) {
if ( Trans[string] !== undefined ) {
return Trans[string];
}
return string;
}