Skip to content

Commit

Permalink
Enables back languages. Filters dev search by language
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzzmi committed Nov 24, 2017
1 parent c310832 commit 38fd71d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 67 deletions.
96 changes: 48 additions & 48 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
langsorder:
# - 'id'
# - 'da'
# - 'de'
- 'id'
- 'da'
- 'de'
- 'en'
# - 'es'
# - 'fr'
# - 'it'
# - 'hu'
# - 'nl'
# - 'pl'
# - 'pt_BR'
# - 'ro'
# - 'sl'
# - 'sv'
# - 'tr'
# - 'el'
# - 'bg'
# - 'ru'
- 'es'
- 'fr'
- 'it'
- 'hu'
- 'nl'
- 'pl'
- 'pt_BR'
- 'ro'
- 'sl'
- 'sv'
- 'tr'
- 'el'
- 'bg'
- 'ru'
- 'uk'
# - 'ar'
# - 'fa'
# - 'hi'
# - 'ko'
# - 'ja'
# - 'zh_CN'
# - 'zh_TW'
- 'ar'
- 'fa'
- 'hi'
- 'ko'
- 'ja'
- 'zh_CN'
- 'zh_TW'

langs:
# 'ar': 'العربية'
# 'bg': 'български'
# 'da': 'Dansk'
# 'de': 'Deutsch'
'ar': 'العربية'
'bg': 'български'
'da': 'Dansk'
'de': 'Deutsch'
'en': 'English'
# 'el': 'Ελληνικά'
# 'es': 'Español'
# 'fa': 'فارسی'
# 'fr': 'Français'
# 'hi': 'हिन्दी'
# 'hu': 'Magyar'
# 'id': 'Bahasa Indonesia'
# 'it': 'Italiano'
# 'ja': '日本語'
# 'ko': '한국의'
# 'nl': 'Nederlands'
# 'pl': 'Polski'
# 'pt_BR': 'Português Brasil'
# 'ro': 'Română'
# 'ru': 'Русский'
# 'sl': 'Slovenščina'
# 'sv': 'Svenska'
# 'tr': 'Türkçe'
'el': 'Ελληνικά'
'es': 'Español'
'fa': 'فارسی'
'fr': 'Français'
'hi': 'हिन्दी'
'hu': 'Magyar'
'id': 'Bahasa Indonesia'
'it': 'Italiano'
'ja': '日本語'
'ko': '한국의'
'nl': 'Nederlands'
'pl': 'Polski'
'pt_BR': 'Português Brasil'
'ro': 'Română'
'ru': 'Русский'
'sl': 'Slovenščina'
'sv': 'Svenska'
'tr': 'Türkçe'
'uk': 'Українська'
# 'zh_CN': '简体中文'
# 'zh_TW': '繁體中文'
'zh_CN': '简体中文'
'zh_TW': '繁體中文'

redirects:
/news: /en/version-history
Expand Down
31 changes: 12 additions & 19 deletions js/devsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,10 @@
# This file is licensed under the MIT License (MIT) available on
# http://opensource.org/licenses/MIT.
---
{% comment %}

NOTICE: if you edit this template, you should also edit
/quality-assurance/devsearches.html which creates a page whose
links can be checked by HTML proofer

Nested loops below:
1. site.devsearches: container for all searches defined in _config.yaml in
the arbitrary order they should appear
2. list: a list item in devsearches; only has two elements:
a. the name of the category
b. an array containing the sublist items (pre-sorted)
3. sublist: a list of the items we want to display as a one-entry hash table
4. term: the term as the key [0] and the uri as the value [1]

{% endcomment %}

"use strict";

var search_data = {{ site.devsearches_json }}


{% raw %}
// code adapted from http://jqueryui.com/autocomplete/#categories
// MIT license: https://jquery.org/license/
Expand Down Expand Up @@ -51,7 +33,18 @@ $.widget("custom.catcomplete", $.ui.autocomplete, {
});
$(function() {
$("#glossary_term").catcomplete({
source: search_data,
source: function(request, respond) {
var lang = $('html').attr('lang');
var term = request.term;

var results = search_data.filter(function(data) {
return (
(data.label.indexOf(term) !== -1 && data.lang === lang) || data.category !== "Glossary"
);
});

respond(results);
},
delay: 0,
minLength: 2,
autoFocus: true,
Expand Down

0 comments on commit 38fd71d

Please sign in to comment.