Added inline translation feature hint.

This commit is contained in:
Martin Edenhofer 2015-12-10 16:37:38 +01:00
parent c29995702e
commit be6c374cdc
4 changed files with 31 additions and 15 deletions

View file

@ -19,7 +19,7 @@ class Index extends App.ControllerContent
@bind('i18n:translation_update_list', =>
@load('i18n:translation_update_list')
)
@bind('i18n:translation_update ui:rerender', =>
@bind('i18n:translation_update', =>
@load()
)
@ -32,7 +32,7 @@ class Index extends App.ControllerContent
@html App.view('translation/index')(
currentLanguage: currentLanguage
)
@load()
@load('render')
load: (event) =>
@ajax(
@ -53,27 +53,27 @@ class Index extends App.ControllerContent
else
@stringsTranslated.push item
if !@translationToDo
if !@translationToDo || event is 'render'
@translationToDo = new TranslationToDo(
el: @$('.js-ToDo')
locale: @locale
updateOnServer: @updateOnServer
getAttributes: @getAttributes
)
if !event || event is 'i18n:translation_update_todo'
if !event || event is 'i18n:translation_update_todo'|| event is 'render'
@translationToDo.update(
stringsNotTranslated: @stringsNotTranslated
stringsTranslated: @stringsTranslated
times: @times
)
if !@translationList
if !@translationList || event is 'render'
@translationList = new TranslationList(
el: @$('.js-List')
locale: @locale
updateOnServer: @updateOnServer
getAttributes: @getAttributes
)
if !event || event is 'i18n:translation_update_list'
if !event || event is 'i18n:translation_update_list'|| event is 'render'
@translationList.update(
stringsNotTranslated: @stringsNotTranslated
stringsTranslated: @stringsTranslated
@ -85,7 +85,6 @@ class Index extends App.ControllerContent
release: =>
rerender = ->
App.Event.trigger('ui:rerender')
console.log('rr')
if @translationList.changes()
App.Delay.set(rerender, 400)
@ -225,10 +224,6 @@ class TranslationToDo extends App.Controller
render: =>
if !App.i18n.notTranslatedFeatureEnabled(@locale)
@html App.view('translation/english')()
return
if !App.i18n.getNotTranslated(@locale) && _.isEmpty(@stringsNotTranslated)
@html ''
return
@ -294,10 +289,11 @@ class TranslationList extends App.Controller
@render()
render: =>
return if _.isEmpty(@stringsTranslated)
return if _.isEmpty(@stringsTranslated) && _.isEmpty(@times)
@html App.view('translation/list')(
times: @times
strings: @stringsTranslated
times: @times
strings: @stringsTranslated
notSourceTranslation: App.i18n.notTranslatedFeatureEnabled(@locale)
)
changes: =>

View file

@ -9,6 +9,16 @@
</div>
</div>
<div class="page-content">
<div class="box box--message">
<h2><%- @T('Inline translation') %></h2>
<p><%- @T('To do easier translations you can enable and disable inline translation feature by pressing "%s".', 'ctrl+alt+t') %></p>
<p><%- @T('Text with disabled inline translations looks like') %> <button class="btn btn-primary"><%- @Ti('Some Text') %></button></p>
<p><%- @T('Text with enabled inline translations looks like') %> <button class="btn btn-primary"><span class="translation" contenteditable="true"><%- @Ti('Some Text') %></button></span></p>
<p><%- @T('Just click into the marker and update the words just in place. Enjoy!') %></p>
<p><%- @T('If you want to translate it via the translation table, just go ahead below.') %></p>
</div>
<div class="js-ToDo"></div>
<div class="js-List"></div>
</div>

View file

@ -22,6 +22,9 @@
</table>
<h2><%- @T('Words') %></h2>
<% if _.isEmpty(@strings) && !@notSourceTranslation: %>
<div><%- @T('English is the source language, so we have nothing to translate.') %></div>
<% else: %>
<table class="translationOverview js-translated table table-striped table-hover">
<thead>
<tr>
@ -43,3 +46,4 @@
<% end %>
</tbody>
</table>
<% end %>

View file

@ -0,0 +1,6 @@
<p <% if @better is false: %>class="hidden"<% end %>>
<%- @T('Only %s% of this language is translated, help to improve Zammad and complete the translation.', @percent) %>
</p>
<p <% if @better is true: %>class="hidden"<% end %>>
<%- @T('Up to %s% of this language is translated, help to make Zammad even better and complete the translation.', @percent) %>
</p>