Selaa lähdekoodia

feat: add translations for insight search

ppoffice 9 vuotta sitten
vanhempi
commit
2b450e5212

+ 7 - 0
languages/en.yml

@@ -28,3 +28,10 @@ profile:
     tag: 'tag'
     posts: 'posts'
     tags: 'tags'
+insight:
+    hint: 'Type something...'
+    posts: 'Posts'
+    pages: 'Pages'
+    categories: 'Categories'
+    tags: 'Tags'
+

+ 6 - 0
languages/es.yml

@@ -28,3 +28,9 @@ profile:
     tag: 'Etiqueta'
     posts: 'Entradas'
     tags: 'Etiquetas'
+insight:
+    hint: 'Type something...'
+    posts: 'Entradas'
+    pages: 'Pages'
+    categories: 'Categorias'
+    tags: 'Etiquetas'

+ 6 - 0
languages/fr.yml

@@ -27,3 +27,9 @@ profile:
     tag: 'Tag'
     posts: 'Articles'
     tags: 'Tags'
+insight:
+    hint: 'Type something...'
+    posts: 'Articles'
+    pages: 'Pages'
+    categories: 'Catégories'
+    tags: 'Tags'

+ 6 - 0
languages/id.yml

@@ -26,3 +26,9 @@ profile:
     tag: 'tag'
     posts: 'pos'
     tags: 'tag'
+insight:
+    hint: 'Type something...'
+    posts: 'pos'
+    pages: 'Pages'
+    categories: 'kategori'
+    tags: 'tag'

+ 6 - 0
languages/ja.yml

@@ -27,3 +27,9 @@ profile:
     tag: 'タグ'
     posts: '投稿'
     tags: 'タグ'
+insight:
+    hint: 'Type something...'
+    posts: '投稿'
+    pages: 'Pages'
+    categories: 'カテゴリ'
+    tags: 'タグ'

+ 6 - 0
languages/ko.yml

@@ -28,3 +28,9 @@ profile:
     tag: '태그'
     posts: '포스트'
     tags: '태그'
+insight:
+    hint: 'Type something...'
+    posts: '포스트'
+    pages: 'Pages'
+    categories: '카테고리'
+    tags: '태그'

+ 6 - 0
languages/ru.yml

@@ -28,3 +28,9 @@ profile:
     tag: 'тэг'
     posts: 'посты'
     tags: 'тэги'
+insight:
+    hint: 'Type something...'
+    posts: 'посты'
+    pages: 'Pages'
+    categories: 'категории'
+    tags: 'тэги'

+ 6 - 0
languages/zh-CN.yml

@@ -28,3 +28,9 @@ profile:
     tag: '标签'
     posts: '文章'
     tags: '标签'
+insight:
+    hint: '想要查找什么...'
+    posts: '文章'
+    pages: '页面'
+    categories: '分类'
+    tags: '标签'

+ 6 - 0
languages/zh-TW.yml

@@ -27,3 +27,9 @@ profile:
     tag: '標籤'
     posts: '文章'
     tags: '標籤'
+insight:
+    hint: 'Type something...'
+    posts: '文章'
+    pages: 'Pages'
+    categories: '分類'
+    tags: '標籤'

+ 3 - 4
layout/search/insight.ejs

@@ -2,7 +2,7 @@
     <div class="ins-search-mask"></div>
     <div class="ins-search-container">
         <div class="ins-input-wrapper">
-            <input type="text" class="ins-search-input" placeholder="Type something..." />
+            <input type="text" class="ins-search-input" placeholder="<%= __('insight.hint') %>" />
             <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
         </div>
         <div class="ins-section-wrapper">
@@ -47,7 +47,7 @@
             switch (type) {
                 case 'POSTS':
                 case 'PAGES':
-                    sectionTitle = type == 'POSTS' ? 'Posts' : 'Pages';
+                    sectionTitle = type == 'POSTS' ? '<%= __("insight.posts") %>' : '<%= __("insight.pages") %>';
                     $searchItems = array.map(function (item) {
                         // Use config.root instead of permalink to fix url issue
                         return searchItem('file', item.title, null, item.text.slice(0, 150), <%= config.root %> + item.path);
@@ -55,7 +55,7 @@
                     break;
                 case 'CATEGORIES':
                 case 'TAGS':
-                    sectionTitle = type == 'CATEGORIES' ? 'Categories' : 'Tags';
+                    sectionTitle = type == 'CATEGORIES' ? '<%= __("insight.categories") %>' : '<%= __("insight.tags") %>';
                     $searchItems = array.map(function (item) {
                         return searchItem(type == 'CATEGORIES' ? 'folder' : 'tag', item.name, item.slug, null, item.permalink);
                     });
@@ -190,7 +190,6 @@
         }
 
         $.getJSON('<%- url_for("/content.json")%>', function (json) {
-            console.log(json)
             $('.ins-search-input').on('input', function () {
                 var keywords = $(this).val();
                 searchResultToDOM(search(json, keywords));