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

View file

@ -9,6 +9,16 @@
</div> </div>
</div> </div>
<div class="page-content"> <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-ToDo"></div>
<div class="js-List"></div> <div class="js-List"></div>
</div> </div>

View file

@ -22,6 +22,9 @@
</table> </table>
<h2><%- @T('Words') %></h2> <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"> <table class="translationOverview js-translated table table-striped table-hover">
<thead> <thead>
<tr> <tr>
@ -43,3 +46,4 @@
<% end %> <% end %>
</tbody> </tbody>
</table> </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>