From be6c374cdc270b7fedd08cfdae7d7380c8af53d0 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 10 Dec 2015 16:37:38 +0100 Subject: [PATCH] Added inline translation feature hint. --- .../app/controllers/translation.coffee | 24 ++++++++----------- .../app/views/translation/index.jst.eco | 10 ++++++++ .../app/views/translation/list.jst.eco | 6 ++++- .../app/views/translation/support.jst.eco | 6 +++++ 4 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 app/assets/javascripts/app/views/translation/support.jst.eco diff --git a/app/assets/javascripts/app/controllers/translation.coffee b/app/assets/javascripts/app/controllers/translation.coffee index ac931f473..30e86fd88 100644 --- a/app/assets/javascripts/app/controllers/translation.coffee +++ b/app/assets/javascripts/app/controllers/translation.coffee @@ -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: => diff --git a/app/assets/javascripts/app/views/translation/index.jst.eco b/app/assets/javascripts/app/views/translation/index.jst.eco index 892e3b25e..39b5858aa 100644 --- a/app/assets/javascripts/app/views/translation/index.jst.eco +++ b/app/assets/javascripts/app/views/translation/index.jst.eco @@ -9,6 +9,16 @@
+ +
+

<%- @T('Inline translation') %>

+

<%- @T('To do easier translations you can enable and disable inline translation feature by pressing "%s".', 'ctrl+alt+t') %>

+

<%- @T('Text with disabled inline translations looks like') %>

+

<%- @T('Text with enabled inline translations looks like') %>

+

<%- @T('Just click into the marker and update the words just in place. Enjoy!') %>

+

<%- @T('If you want to translate it via the translation table, just go ahead below.') %>

+
+
\ No newline at end of file diff --git a/app/assets/javascripts/app/views/translation/list.jst.eco b/app/assets/javascripts/app/views/translation/list.jst.eco index a0e669d4b..216f0d859 100644 --- a/app/assets/javascripts/app/views/translation/list.jst.eco +++ b/app/assets/javascripts/app/views/translation/list.jst.eco @@ -22,6 +22,9 @@

<%- @T('Words') %>

+<% if _.isEmpty(@strings) && !@notSourceTranslation: %> +
<%- @T('English is the source language, so we have nothing to translate.') %>
+<% else: %> @@ -42,4 +45,5 @@
<%- @T('Reset') %> <% end %> -
\ No newline at end of file + +<% end %> \ No newline at end of file diff --git a/app/assets/javascripts/app/views/translation/support.jst.eco b/app/assets/javascripts/app/views/translation/support.jst.eco new file mode 100644 index 000000000..c80905cee --- /dev/null +++ b/app/assets/javascripts/app/views/translation/support.jst.eco @@ -0,0 +1,6 @@ +

class="hidden"<% end %>> +<%- @T('Only %s% of this language is translated, help to improve Zammad and complete the translation.', @percent) %> +

+

class="hidden"<% end %>> +<%- @T('Up to %s% of this language is translated, help to make Zammad even better and complete the translation.', @percent) %> +

\ No newline at end of file