diff --git a/_layouts/wallet-container.html b/_layouts/wallet-container.html
index 1da4069c..4ec055dd 100644
--- a/_layouts/wallet-container.html
+++ b/_layouts/wallet-container.html
@@ -3,6 +3,7 @@
# http://opensource.org/licenses/MIT.
layout: wallet-platform-container
+max_wallet_text_length: 418 ## Unicode characters
---
diff --git a/_plugins/wallets.rb b/_plugins/wallets.rb
index 292b7942..515ca1d8 100644
--- a/_plugins/wallets.rb
+++ b/_plugins/wallets.rb
@@ -6,7 +6,7 @@ require 'yaml'
module Jekyll
class WalletPage < Page
- def initialize(site, base, dir, wallet, platform, os)
+ def initialize(site, base, dir, wallet, platform, os, lang)
@site = site
@base = base
@dir = dir
@@ -18,6 +18,7 @@ module Jekyll
self.data['platform'] = platform
self.data['os'] = os
self.data['id'] = ['wallets', platform['name'], os['name'], wallet['id']].join('-')
+ self.data['lang'] = lang
end
end
@@ -25,27 +26,61 @@ module Jekyll
safe true
def generate(site)
+ # Get the collection of wallets from _wallets
walletsCol = site.collections['wallets'];
+
+ # Output dir
+ # TODO: Make this configurable and "translatable"
walletsDir = 'wallets'
+ # Loading translations.
+ # Copy-paste from _plugins/templates.rb
+ locs = {}
+ enabled = ENV['ENABLED_LANGS'];
+ enabled = enabled.split(' ') if !enabled.nil?
+ Dir.foreach('_translations') do |file|
+ next if file == '.' or file == '..' or file == 'COPYING'
+ lang = file.split('.')[0]
+ # Ignore language if it's disabled
+ if lang != 'en' and !enabled.nil? and !enabled.include?(lang)
+ puts('Lang ' + lang + ' disabled')
+ next
+ end
+ locs[lang] = YAML.load_file("_translations/"+file)[lang]
+ end
+
+ puts('----- Generating wallet pages -----')
+
+ # Getting information about each found wallet
walletsCol.docs.each do |doc|
file = doc.path
wallet = YAML.load_file(file)
walletPlatforms = wallet['platform']
- puts('---------------------')
- puts(wallet['id'])
+ puts(wallet['id'] + ' is loaded. Generating pages...')
+ # Going through all available combinations of
+ # platforms and OSes
walletPlatforms.each do |platform|
platform['os'].each do |os|
+
+ # This allows generation only of valid wallet pages
if platform['name']
+
+ locs.each do |lang,value|
dir = File.join(platform['name'], os['name'], wallet['id'])
- site.pages << WalletPage.new(site, site.source, File.join('en', walletsDir, dir), wallet, platform, os)
+ site.pages << WalletPage.new(site, site.source, File.join(lang, walletsDir, dir), wallet, platform, os, lang)
+ end
end
+
end
end
+
+ puts(wallet['id'] + ' is processed.')
end
+ puts('----- Wallet pages generated -----')
+
end
end
diff --git a/_templates/choose-your-wallet.html b/_templates/choose-your-wallet.html
index 076663e2..6e2fc766 100755
--- a/_templates/choose-your-wallet.html
+++ b/_templates/choose-your-wallet.html
@@ -5,109 +5,11 @@
# Definitions for the property checks below can be found here:
# https://github.com/bitcoin-dot-org/bitcoin.org/blob/master/_translations/en.yml
-layout: base
+layout: wallet-platform
id: choose-your-wallet
-max_wallet_text_length: 418 ## Unicode characters
+
+platform:
+ name: desktop
+os:
+ name: windows
---
-
-
-
-
{% translate pagetitle %}
-
{% translate pagedesc %}
-
-
-
-
-{% for wallet in site.wallets %}{% for wallet in wallet %}{% if wallet[1].platform.mobile %}{% assign platform = wallet[1].platform.mobile %}{% elsif wallet[1].platform.desktop %}{% assign platform = wallet[1].platform.desktop %}{% elsif wallet[1].platform.hardware %}{% assign platform = wallet[1].platform.hardware %}{% else %}{% assign platform = wallet[1].platform.web %}{% endif %}
-
-
-
-
{{ wallet[1].title }}
-
{% for os in platform.os %}

{% unless wallet[1].compat contains os %}{% die platform not listed in compat field %}{% endunless %}{% endfor %}
-
-
- {% for check in platform.check %}{% if check[0] == 'privacy' and platform.privacycheck %}
-
{% translate {{check[1]}} %}
- {% for privacycheck in platform.privacycheck %}
-
-
{% translate {{privacycheck[1]}} %}
-
{% translate {{privacycheck[1]}}txt %}
-
- {% endfor %}
-
- {% else %}
-
{% translate {{check[1]}} %}
{% translate {{check[1]}}txt %}
- {% endif %}{% endfor %}
-
- {% capture platform_text %}{% translate {{platform.text}} %}{% endcapture %}
- {% assign platform_text_length = platform_text | size %}
-
{% if platform_text_length > page.max_wallet_text_length %}{% die Wallet text too long %}{% else %}{{platform_text}}{% endif %}
-
-
-
{{ wallet[1].titleshort }}
-
-{% endfor %}{% endfor %}
-
-
-
-{% for wallet in page.wallets %}{% for wallet in wallet %}{% for platform in wallet[1].platform %}
-
-{% endfor %}{% endfor %}{% endfor %}
-
-
-
-
-
-
-
-
{% translate educate %}
-
{% translate educatetxt %}
-