mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 01:36:13 +00:00
Make translate.rb plugin fallback to English by default
Display English content in outdated translated templates when this doesn't cause too much issues
This commit is contained in:
parent
5f2d32d134
commit
78b04ea0ee
13 changed files with 21 additions and 77 deletions
|
@ -63,6 +63,18 @@ module Jekyll
|
|||
if ar.has_key?(id) && ar[id].is_a?(String)
|
||||
text = ar[id]
|
||||
end
|
||||
#fallback to English if string is empty
|
||||
if text == ''
|
||||
lang = 'en'
|
||||
ar = site['loc'][lang]
|
||||
for key in keys do
|
||||
break if !ar.is_a?(Hash) || !ar.has_key?(key) || !ar[key].is_a?(Hash)
|
||||
ar = ar[key]
|
||||
end
|
||||
if ar.has_key?(id) && ar[id].is_a?(String)
|
||||
text = ar[id]
|
||||
end
|
||||
end
|
||||
#replace urls and anchors in string
|
||||
url = site['loc'][lang]['url']
|
||||
url.each do |key,value|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue