From 600a265765882e2897cb6b38246c5e6fc49fe2fd Mon Sep 17 00:00:00 2001 From: Eduardo Date: Sat, 17 Aug 2019 20:34:39 +0200 Subject: [PATCH] Improve the translations --- README.md | 1 + assets/js/app.js | 2 +- index.hbs | 2 +- locales/de-informal.json | 10 ++++++++-- locales/de.json | 10 ++++++++-- locales/en.json | 10 ++++++++-- locales/es.json | 38 ++++++++++++++++++++++++++++++++++++++ package.json | 2 +- partials/loop.hbs | 4 ++-- partials/search.hbs | 5 +++-- post.hbs | 4 ++-- src/js/app.js | 9 ++++++++- subscribe.hbs | 2 +- 13 files changed, 82 insertions(+), 17 deletions(-) create mode 100644 locales/es.json diff --git a/README.md b/README.md index 94f8607..7b1decd 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ To download the latest version please head over the [releases page](https://gith ### Liebling unique features +* Support for translations * Search * Custom Subscribe page * Custom authors page diff --git a/assets/js/app.js b/assets/js/app.js index 5745f01..3c87908 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{27:function(e,s,t){e.exports=t(28)},28:function(e,s,t){"use strict";t.r(s);var n=t(0),a=t.n(n),o=(t(6),t(15)),i=t(17),l=t.n(i),c=t(18),r=t(20),d=t.n(r);a()(document).ready(function(){var e,s,t,n,i,r=a()("body"),u=a()(".js-header"),m=a()(".js-open-menu"),h=a()(".js-close-menu"),f=a()(".js-menu"),v=a()(".js-toggle-submenu"),p=a()(".js-submenu-option")[0],g=a()(".js-submenu"),C=a()(".js-recent-articles"),w=a()(".js-open-search"),b=a()(".js-close-search"),j=a()(".js-search"),k=a()(".js-input-search"),y=a()(".js-search-results"),x=u.outerHeight(),_=null,L=window.pageYOffset,A=!1,O=!1;function S(){var e=window.pageYOffset;e>=x?(u.addClass("fixed"),O&&u.addClass("fixed-active"),e>=L?O||u.removeClass("fixed-active"):u.addClass("fixed-active")):(O||u.removeClass("fixed-active"),u.removeClass("fixed")),L=e,A=!1}function D(){u.removeClass("submenu-is-active"),v.removeClass("active"),g.removeClass("opened").addClass("closed")}function E(){r.toggleClass("no-scroll-y")}m.click(function(){f.addClass("opened"),E()}),h.click(function(){f.removeClass("opened"),E()}),v.click(function(){(O=!O)?(u.addClass("submenu-is-active"),v.addClass("active"),g.removeClass("closed").addClass("opened")):D()}),w.click(function(){j.addClass("opened"),setTimeout(function(){k.focus()},400),E()}),b.click(function(){k.blur(),j.removeClass("opened"),E()}),k.keyup(function(){if(k.val().length>0&&_){var e=_.search(k.val()),s="";if(e.length>0){for(var t=0,n=e.length;t

').concat(e[t].title,'

').concat((a=e[t].published_at)?new Date(a).toLocaleDateString(document.documentElement.lang,{year:"numeric",month:"long",day:"numeric"}):"","
");y.html(s)}else y.html('

0 results for your search, try something different.')}else y.html("");var a}),a()(window).click(function(e){O&&p&&!p.contains(e.target)&&(O=!1,D())}),C.length>0&&C.slick({adaptiveHeight:!0,arrows:!1,infinite:!1,mobileFirst:!0,variableWidth:!0}),l.a.init({once:!0,startEvent:"DOMContentLoaded"}),Object(o.a)(".js-tooltip"),"undefined"!=typeof ghostSearchApiKey?(e=ghostHost,s=ghostSearchApiKey,t=new c.a({host:e,key:s,version:"v2"}),n=[],i={shouldSort:!0,threshold:0,location:0,distance:100,tokenize:!0,matchAllTokens:!0,maxPatternLength:32,minMatchCharLength:1,keys:["title","custom_excerpt","html"]},t.posts.browse({limit:"all",fields:"id, title, url, published_at, custom_excerpt, html"}).then(function(e){for(var s=0,t=e.length;s=_?(u.addClass("fixed"),S&&u.addClass("fixed-active"),e>=A?S||u.removeClass("fixed-active"):u.addClass("fixed-active")):(S||u.removeClass("fixed-active"),u.removeClass("fixed")),A=e,O=!1}function E(){u.removeClass("submenu-is-active"),v.removeClass("active"),g.removeClass("opened").addClass("closed")}function H(){r.toggleClass("no-scroll-y")}h.click(function(){f.addClass("opened"),H()}),m.click(function(){f.removeClass("opened"),H()}),v.click(function(){(S=!S)?(u.addClass("submenu-is-active"),v.addClass("active"),g.removeClass("closed").addClass("opened")):E()}),C.click(function(){b.addClass("opened"),setTimeout(function(){k.focus()},400),H()}),j.click(function(){k.blur(),b.removeClass("opened"),H()}),k.keyup(function(){if(k.val().length>0&&L){var e=L.search(k.val()),s="";if(e.length>0){for(var t=0,n=e.length;t

').concat(e[t].title,'

').concat((a=e[t].published_at)?new Date(a).toLocaleDateString(document.documentElement.lang,{year:"numeric",month:"long",day:"numeric"}):""," ");x.hide(),y.html(s),y.show()}else y.html(""),y.hide(),x.show()}else y.html(""),y.hide(),x.hide();var a}),a()(window).click(function(e){S&&p&&!p.contains(e.target)&&(S=!1,E())}),w.length>0&&w.slick({adaptiveHeight:!0,arrows:!1,infinite:!1,mobileFirst:!0,variableWidth:!0}),l.a.init({once:!0,startEvent:"DOMContentLoaded"}),Object(o.a)(".js-tooltip"),"undefined"!=typeof ghostSearchApiKey?(e=ghostHost,s=ghostSearchApiKey,t=new c.a({host:e,key:s,version:"v2"}),n=[],i={shouldSort:!0,threshold:0,location:0,distance:100,tokenize:!0,matchAllTokens:!0,maxPatternLength:32,minMatchCharLength:1,keys:["title","custom_excerpt","html"]},t.posts.browse({limit:"all",fields:"id, title, url, published_at, custom_excerpt, html"}).then(function(e){for(var s=0,t=e.length;s diff --git a/post.hbs b/post.hbs index 5724060..cb5dedb 100644 --- a/post.hbs +++ b/post.hbs @@ -77,7 +77,7 @@ into the {body} of the default.hbs template --}} input_class="m-input in-subscribe-section" button_id="subscribe_button" button_class="m-button primary block" - placeholder="Your email address" + placeholder=(t "Your email address") }} @@ -105,7 +105,7 @@ into the {body} of the default.hbs template --}} {{#has author="count:>1"}}

- {{authors separator=", " prefix="Among with " from="2"}} + {{authors separator=", " prefix=(t "Among with no break line") from="2"}}

{{/has}} {{#if primary_author.bio}} diff --git a/src/js/app.js b/src/js/app.js index 203609d..76af7ac 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -20,6 +20,7 @@ $(document).ready(() => { const $search = $('.js-search') const $inputSearch = $('.js-input-search') const $searchResults = $('.js-search-results') + const $searchNoResults = $('.js-no-results') const headerHeight = $header.outerHeight() @@ -195,12 +196,18 @@ $(document).ready(() => { ` } + $searchNoResults.hide() $searchResults.html(htmlString) + $searchResults.show() } else { - $searchResults.html('

0 results for your search, try something different.') + $searchResults.html('') + $searchResults.hide() + $searchNoResults.show() } } else { $searchResults.html('') + $searchResults.hide() + $searchNoResults.hide() } }) diff --git a/subscribe.hbs b/subscribe.hbs index 992f9d7..cfc3b39 100644 --- a/subscribe.hbs +++ b/subscribe.hbs @@ -30,7 +30,7 @@ into the {body} of the default.hbs template --}} input_class="m-input in-subscribe-section" button_id="subscribe_button" button_class="m-button primary block" - placeholder="Your email address" + placeholder=(t "Your email address") autofocus="true" }}