feat: add translations for insight search

This commit is contained in:
ppoffice 2016-04-07 10:45:17 +08:00
parent 56b701b9bd
commit 2b450e5212
10 changed files with 58 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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