Unverified Commit ab0ae4aa authored by Mike McDonald's avatar Mike McDonald
Browse files

Set up multi lang plugin and begin chinese translations

parent a020c614
......@@ -13,6 +13,7 @@ kramdown:
smart_quotes: ["apos", "apos", "quot", "quot"]
exclude: ["README.md"]
languages: ["en", "cn"]
gems: [jekyll-paginate]
paginate: 10
paginate_path: blog/page:num/
......
global:
date: '%Y/%m/%d'
monero: 门罗币
getting_started: 启用
copyright: Copyright
monero_project: The Monero Project
sitename: getmonero.org, The Monero Project
wiki: Moneropedia
tags: Articles By Tag
wikimeta: on Moneropedia, the open encyclopedia of Monero knowledge
tagsmeta: All Monero blog articles that are tagged
titlemeta: on the home of Monero, a digital currency that is secure, private, and untraceable
terms: 条款
privacy: 隐私
copyright: 版权
menu:
forum: 论坛
blog: 博客
knowledge_base: 知识库
community: 社区
bitcointalk: Bitcointalk Thread
reddit: Reddit
allblog: All Blog Posts
devdiaries: Dev Diaries
missives: Monero Missives
uncategorised: Uncategorized
choose: How to Choose a Monero Client
running: How to Run a Monero Node
donations: Donating and Sponsorships
downloads: All Monero Downloads
merchants: Merchants and Services Directory
accepting: Accepting Monero Payments
about: About Monero
people: The People Behind Monero
userguides: User Guides
developerguides: Developer Guides
goals: Design & Development Goals
openalias: The OpenAlias Project
lab: Monero Research Lab
alternative: Alternative Clients
projects: External Projects
irc: IRC on Freenode
irc-general: "#monero (General)"
irc-development: "#monero-dev (Development)"
irc-trading: "#monero-otc (OTC Trading)"
irc-markets: "#monero-markets (Markets)"
irc-mining: "#monero-pools (Mining)"
index:
page_title: "Monero - secure, private, untraceable"
what_is_1: "什么是门罗币"
what_is_2: " ?"
what_is_orange_block: "门罗币是一种安全性,隐私性极高的货币,同时具有开放性,适用人群广泛等特点。"
what_is_text_block_1: "使用门罗币时,您可以控制您的银行,操控并负责管理您的资金,其他人无法追踪您的任何货币 转移行为。"
what_is_text_block_2: "想了解更多吗?请参考下文中门罗币的主要特点,如您有兴趣尝试门罗币,只需点击网页上方的"
what_is_text_block_3: "启用标签,"
what_is_text_block_4: "便可享受门罗币的卓越性。"
news: 消息
the_latest: 最新
private: 隐私性
secure: 安全性
untraceable: 无迹可寻
private_text: "门罗币采用加密安全系统,因此,无论是转入还是转出资金,数据区块(分布交易总账)都 很难查出您的交易信息。这保障您的购买,接收,转账行为长期并自动处于隐秘状态。"
untraceable_text: "群签名是一种加密系统的特性。利用此特性,门罗币便可以保障交易不禁无迹可寻,而且用户也可选择模糊交易与计算机或用户间的联系。"
secure_text: "每笔交易都因受到点对点共识网络的保障而具有高度安全性。个人账户在创建时会显示 25个记忆种子,并可被记录下来以作备份。账户文件可加密,因此,盗取这些文件也是无用功。"
how_do_i_1: "我又如何"
how_do_i_2: " ?"
get_started: 开始呢
get_started_1: "最快的启用方式便是网络账户经理,如, "
mymonero: "MyMonero"
get_started_2: "."
get_started_3: "或者,如果您希望运行完整门罗币网络节点,请点击右侧下载链接,下载用户端及反冲启动 数据区块(加速下载本地用户端)"
where_can_i: 在哪里
download_1: 下载
download_2: " ?"
different_os: "您使用的是其他操作系统吗?"
all_downloads: 查看所有可用版本
c_download: 下载
monero_for: 用户
latest_blockchain: 最新数据区块
blog:
title_1: All
title_2: Blog
title_3: Posts
tagged: Tagged under
author: Posted by
forum: Click here to join the discussion for this entry on the Monero Forum
tags:
all: Articles by Tag
notags: There are no posts for this tag.
gs:
how_to: 如何
choose:
mobile_web_lightweight: "手机版,网页版,和轻巧版客户端"
mobile_web_lightweight_text_1: "如您是门罗币(Monero)的初次使用者,以下便介绍的客户端便是理想之选,同时适用于设备"
mobile_web_lightweight_text_2: "性能有限,不能运行完整网络节点的用户"
my_monero_text_1: "MyMonero.com"
my_monero_text_2: " 使用方法简单,可直接在浏览器总打开,无需下载安装。 此网页无法代替您支配您的门罗币资金,因此安全度高。网站由门罗币核心团队成员之一 Riccardo Spagni 负责操作运营。"
full_client: "完整门罗币客户端"
full_client_text: "如您可以扩展带宽及硬盘空间,并运行完整网络节点,您便可享受强大而稳定的网络,以及门罗"
monero_node_text_1: "请参考"
monero_node_text_2: "门罗币网络节点运行"
monero_node_text_3: "指南,也可以从"
monero_node_text_4: "下载页面"
third_party_clients: "第三方客户端"
third_party_text: "其他与门罗币官方后台合作的第三方客户端会提供其他附加功能。"
monerox: "MoneroX 是.NET 版本的门罗币用户界面,此界面适用于 Windows,Mac Linux.MoneroX 由"
lightwallet: "LightWallet 是一款轻便简单 Python 版的用户端。此用户端适用于多数操作系统。由 jwinterm"
running:
run_a: "运行"
monero_node: "门罗币网络节点(Monero Node)"
why_run: "为什么要运转完整网络节点?"
why_run_text_1: "门罗币网络系统的分散性和对应性决定了它规模越大,功能越强大,灵活性也越高。我们鼓励所 有有条件的用户使用完整网络节点。"
why_run_text_2: "运行门罗币网络节点并不需要强大的处理器,但您确实需要用几个 GB 的硬板空间来安置数据区 块链,并且会对您的带宽有一定影响,特别是与数据区块链连接的网络节点。"
why_run_text_3: "运行门罗币网络节点,而不影响您家庭带宽最简单的方法,是购买 VPS(虚拟专用服务器)。我们强烈推荐 InterServer.net。使用“门罗币”优惠券代码可享受原价 $6/月基础上的折扣。使 用此优惠券代码或友情链接也意味着您为门罗币的发展给予一臂之力。"
why_run_text_4: "门罗币可在多数硬件条件下运行,包括 ARM 32 位系统。运行网络节点之前,请在下载页面 下载门罗币二进制文件。"
running_node: "运行网络节点"
running_node_text_1: "旦文件下载及解压完成,您只需开始运行门罗币后台,无需任何其他操作。"
running_node_text_2: "- Windows 用户:在 Windows 资源管理器中找到 bitmonerod.exe 并双击。如程序开启 后自动关闭或崩溃,您可以在命令提示符内启动,看是否依然出现同样问题。"
running_node_text_3: "- OS X 用户:在 Finder 中找到 bitmonerod 并双击。与 Windows 相同,如程序开启后 自动关闭或崩溃,您可以尝试在 Terminal 中启动。"
running_node_text_4: "- Linux用户:如您在桌面或服务器操作系统上运行它,与此对应您可在Screen作业中或 其本身的控制台窗口启动 bitmonerod"
correctly: "确保您的节点运行正确"
correctly_text_1: "首次启动门罗网络节点时,你屏幕会显示如下图:"
correctly_text_2: "黄色文字表示在同步更新门罗网络的剩余部分同时,它也在接收的数据区块。一旦同步成功完成, 屏幕会显示绿色的'synchronized OK'字样。至此,您的门罗网络节点顺利开始运行!"
correctly_text_3: "若要退出节点,您可在任何时候在后台键入'exit',然后按回车键,程序便会自行关闭。"
global:
date: '%Y/%m/%d'
monero: Monero
getting_started: Getting Started
copyright: Copyright
monero_project: The Monero Project
sitename: getmonero.org, The Monero Project
wiki: Moneropedia
tags: Articles By Tag
wikimeta: on Moneropedia, the open encyclopedia of Monero knowledge
tagsmeta: All Monero blog articles that are tagged
titlemeta: on the home of Monero, a digital currency that is secure, private, and untraceable
terms: Terms
privacy: Privacy
copyright: Copyright
menu:
forum: Forum
blog: Blog
knowledge_base: Knowledge Base
community: Community
bitcointalk: Bitcointalk Thread
reddit: Reddit
allblog: All Blog Posts
devdiaries: Dev Diaries
missives: Monero Missives
uncategorised: Uncategorized
choose: How to Choose a Monero Client
running: How to Run a Monero Node
donations: Donating and Sponsorships
downloads: All Monero Downloads
merchants: Merchants and Services Directory
accepting: Accepting Monero Payments
about: About Monero
people: The People Behind Monero
userguides: User Guides
developerguides: Developer Guides
goals: Design & Development Goals
openalias: The OpenAlias Project
lab: Monero Research Lab
alternative: Alternative Clients
projects: External Projects
irc: IRC on Freenode
irc-general: "#monero (General)"
irc-development: "#monero-dev (Development)"
irc-trading: "#monero-otc (OTC Trading)"
irc-markets: "#monero-markets (Markets)"
irc-mining: "#monero-pools (Mining)"
index:
page_title: "Monero - secure, private, untraceable"
what_is_1: What is
what_is_2: " ?"
what_is_orange_block: "Monero is a secure, private, untraceable currency. It is open-source and freely available to all."
what_is_text_block_1: "With Monero, you are your own bank. Only you control and are responsible for your funds, and your accounts and transactions are kept private from prying eyes."
what_is_text_block_2: "Want to find out more? An overview of Monero's main features are below. If you'd like to try Monero for yourself the"
what_is_text_block_3: "Getting Started"
what_is_text_block_4: "section is an excellent launching point."
news: News
the_latest: The Latest
private: Private
secure: Secure
untraceable: Untraceable
private_text: "Monero uses a cryptographically sound system that allows you to send and receive funds without your @transactions being publically visible on the @blockchain (the distributed ledger of transactions). This ensures that your purchases, receipts, and other transfers remain private by default."
untraceable_text: "By taking advantage of @ring-signatures, a special property of certain types of cryptography, Monero enables untraceable transactions. This means it's ambiguous which funds have been spent, and thus extremely unlikely that a transaction could be linked to particular user."
secure_text: "Using the power of a distributed peer-to-peer @consensus network, every transaction is cryptographically secured. Individual @accounts have a 25 word @mnemonic-seed displayed when created, which can be written down to back up the @account. Account files are encrypted with a passphrase to ensure they are worthless if stolen."
how_do_i_1: "How do I "
how_do_i_2: " ?"
get_started: get started
get_started_1: "The fastest way to start using Monero is with a web @account manager such as "
mymonero: "MyMonero"
get_started_2: "."
get_started_3: "Alternatively, if you would like to run a [full Monero node](/getting-started/running) you can download the client and a kick-starter @blockchain (to bring your local client up to speed) using the download link on the right."
where_can_i: Where can I
download_1: download
download_2: " ?"
different_os: "Need it for a different operating system?"
all_downloads: View all available downloads here
c_download: Download
monero_for: Monero for
latest_blockchain: Latest @Blockchain
blog:
title_1: All
title_2: Blog
title_3: Posts
tagged: Tagged under
author: Posted by
forum: Click here to join the discussion for this entry on the Monero Forum
tags:
all: Articles by Tag
notags: There are no posts for this tag.
gs:
how_to: How to
choose:
mobile_web_lightweight: "Mobile, Web, and Lightweight Clients"
mobile_web_lightweight_text_1: "The clients below are ideal if you are using Monero for the first time. They are also useful if you are on a device that cannot run a "
mobile_web_lightweight_text_2: "full Monero node."
my_monero_text_1: "MyMonero.com"
my_monero_text_2: " is easy-to-use and works in your browser without you needing to install anything. It can be used with some measure of safety, as MyMonero are unable to spend your funds on your behalf. It is owned and operated by Riccardo Spagni, one of the Monero Core Team members."
full_client: "Full Monero Client"
full_client_text: "If you are able to spare the bandwidth and disk space required to run a full node, doing so helps keep the network stable and robust, and also affords you the maximum privacy Monero has to offer."
monero_node_text_1: "You can read our guide on "
monero_node_text_2: "running a Monero node"
monero_node_text_3: ", and the Monero core software can be downloaded from the "
monero_node_text_4: "downloads page"
third_party_clients: "Third-Party Clients"
third_party_text: "There are also several third-party clients that interact with the official Monero core daemon, and are able to provide their own additional functionality."
monerox: "MoneroX is a GUI for Monero written in .NET and available for Windows, Mac, and Linux. It is written and maintained by Jojatekok."
lightwallet: "lightWallet is a simple and slim client written in Python, and should run on most operating systems. It is written and maintained by jwinterm."
running:
run_a: "RUN A"
monero_node: "MONERO NODE"
why_run: "Why Run a Full Node?"
why_run_text_1: "Because of the decentralized and peer-to-peer nature of the Monero network it becomes more robust and resilient as it becomes larger. We encourage all users to run a full node, if they are able to."
why_run_text_2: "Running a Monero node does not require a huge amount of processing power, but it does require a few gigabytes worth of disk space to store the blockchain, and there will be some impact on your bandwidth especially from connected nodes that are catching up on the blockchain."
why_run_text_3: "The easiest way to run a Monero node, without affecting your home bandwidth, is to purchase a VPS (Virtual Private Server). We strongly recommend [InterServer.net](https://interserver.net/dock/vps-231552.html) using the 'MONERO' coupon code to get a discount over and above their already cheap $6/month VPS. Using this coupon code and/or our [affiliate link](https://interserver.net/dock/vps-231552.html) will also assist in the ongoing funding of Monero development."
why_run_text_4: "Monero will run on most hardware, including ARM and 32-bit systems. In order to prepare to run the node download the Monero binaries from the [from the downloads page](/downloads)."
running_node: "Running the Node"
running_node_text_1: "Once you have the files downloaded and unpacked you don't need to do anything beyond running the Monero daemon."
running_node_text_2: "- On Windows: locate bitmonerod.exe in Windows Explorer and double-click on it. If it opens and then closes, or crashes after starting, then you may want to start it from within Command Prompt in order to see what errors arise."
running_node_text_3: "- On OS X: locate bitmonerod in Finder and double-click on it. As with Windows, if it opens and then closes, or crashes after starting, then you can start it from within Terminal."
running_node_text_4: "- On Linux: dependent on whether you are running it on a desktop or server operating system, you will want to start bitmonerod either in a screen session or in a console window of its own."
correctly: "Ensuring Your Node is Running Correctly"
correctly_text_1: "When starting Monero for the first time you will see something similar to this screen:"
correctly_text_2: "The yellow text indicates it is receiving blocks as it synchronises up with the rest of the Monero network. The green 'synchronized ok' text will appear once it has correctly synched up. Once you see this there's nothing further you need to do, you are now running a Monero node!"
correctly_text_3: "To exit the node at any time you can type 'exit' into the daemon window and press enter, and it will shut itself down."
# Just a placeholder plugin to do translated strings, gives us room and scope to get the
# jekyll-multiple-languages-plugin to work correctly
module Jekyll
module Translated
module Strings
module Multiple
module Languages
module Plugin
VERSION = "0.1"
VERSION = "1.2.9"
end
end
end
end
module Jekyll
class Site
def read_directories(dir = '')
base = in_source_dir(dir)
entries = Dir.chdir(base) { filter_entries(Dir.entries('.'), base) }
read_posts(dir)
read_drafts(dir) if show_drafts
posts.sort!
limit_posts! if limit_posts > 0 # limit the posts if :limit_posts option is set
entries.each do |f|
f_abs = in_source_dir(base, f)
if File.directory?(f_abs)
f_rel = File.join(dir, f)
read_directories(f_rel) unless dest.sub(/\/$/, '') == f_abs
elsif Utils.has_yaml_header?(f_abs)
page = Page.new(self, source, dir, f)
pages << page if publisher.publish?(page)
else
static_files << StaticFile.new(self, source, dir, f)
end
end
pages.sort_by!(&:name)
end
def read_posts(dir)
posts = read_content(dir, '_posts', Post)
posts.each do |post|
aggregate_post_info(post) if publisher.publish?(post)
end
end
def read_content(dir, magic_dir, klass)
get_entries(dir, magic_dir).map do |entry|
klass.new(self, source, dir, entry) if klass.valid?(entry)
end.reject do |entry|
entry.nil?
end
end
def get_entries(dir, subfolder)
base = in_source_dir(dir, subfolder)
return [] unless File.exist?(base)
entries = Dir.chdir(base) { filter_entries(Dir['**/*'], base) }
entries.delete_if { |e| File.directory?(in_source_dir(base, e)) }
end
end
end
module Jekyll
@parsedlangs = {}
def self.langs
@parsedlangs
end
def self.setlangs(l)
@parsedlangs = l
end
class Site
alias :process_org :process
def process
if !self.config['baseurl']
self.config['baseurl'] = ""
end
#Variables
config['baseurl_root'] = self.config['baseurl']
baseurl_org = self.config['baseurl']
languages = self.config['languages']
exclude_org = self.exclude
dest_org = self.dest
#Loop
self.config['lang'] = self.config['default_lang'] = languages.first
puts
puts "Building site for default language: \"#{self.config['lang']}\" to: #{self.dest}"
process_org
languages.drop(1).each do |lang|
# Build site for language lang
@dest = @dest + "/" + lang
self.config['baseurl'] = self.config['baseurl'] + "/" + lang
self.config['lang'] = lang
# exclude folders or files from beeing copied to all the language folders
exclude_from_localizations = self.config['exclude_from_localizations'] || []
@exclude = @exclude + exclude_from_localizations
puts "Building site for language: \"#{self.config['lang']}\" to: #{self.dest}"
process_org
#Reset variables for next language
@dest = dest_org
@exclude = exclude_org
self.config['baseurl'] = baseurl_org
end
Jekyll.setlangs({})
puts 'Build complete'
end
alias :read_posts_org :read_posts
def read_posts(dir)
if dir == ''
read_posts("_i18n/#{self.config['lang']}/")
else
read_posts_org(dir)
end
end
alias :read_directories_org :read_directories
def read_directories(dir = '')
if dir == ''
dir = "_i18n/#{self.config['lang']}/"
end
base = in_source_dir(dir)
entries = Dir.chdir(base) { filter_entries(Dir.entries('.'), base) }
read_posts(dir)
read_drafts(dir) if show_drafts
posts.sort!
limit_posts! if limit_posts > 0 # limit the posts if :limit_posts option is set
entries.each do |f|
f_abs = in_source_dir(base, f)
if File.directory?(f_abs)
f_rel = File.join(dir, f)
read_directories(f_rel) unless dest.sub(/\/$/, '') == f_abs
elsif Utils.has_yaml_header?(f_abs) || File.extname(f_abs) == ".md"
page = Page.new(self, source, dir, f)
pages << page if publisher.publish?(page)
else
static_files << StaticFile.new(self, source, dir, f)
end
end
pages.sort_by!(&:name)
end
end
module Convertible
def write(dest)
lang = self.site.config['lang']
default_lang = self.site.config['default_lang']
path = destination(dest)
dest_path = path
if path.include?('/_i18n/')
start_index = path.index '_i18n/'
if self.is_a?(Jekyll::Post)
end_index = path.index '/posts/'
dest_path = path[0..start_index-1] + path[(end_index + 1) .. path.length]
elsif self.is_a?(Jekyll::Page)
dest_path = path[0..start_index-1] + path[(start_index + 9) .. path.length]
end
end
FileUtils.mkdir_p(File.dirname(dest_path))
File.open(dest_path, 'wb') do |f|
f.write(output)
end
end
end
class Post
def url
rel_url = URL.new({
:template => template,
:placeholders => url_placeholders,
:permalink => permalink
}).to_s
if rel_url.include?('/_i18n/')
start_index = rel_url.index '_i18n/'
end_index = rel_url.index '/posts/'
rel_url = rel_url[0..start_index-1] + rel_url[(end_index + 1) .. rel_url.length]
end
@url ||= rel_url
end
end
class StaticFile
def write(dest)
dest_path = destination(dest)
orig_path = dest_path
if dest_path.include?('/_i18n/')
start_index = dest_path.index '_i18n/'
dest_path = dest_path[0..start_index-1] + dest_path[(start_index + 9) .. dest_path.length]
end
# p "#{self.class} #{dest_path}"
return false if File.exist?(dest_path) and !modified?
@@mtimes[path] = mtime
FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.rm(dest_path) if File.exist?(dest_path)
FileUtils.cp(path, dest_path)
true
end
end
class LocalizeTag < Liquid::Tag
def initialize(tag_name, key, tokens)
......@@ -25,28 +238,63 @@ module Jekyll
else
key = @key
end
lang = context.registers[:site].config['lang']
unless Jekyll.langs.has_key?(lang)
puts "Loading translation from file #{context.registers[:site].source}/_i18n/#{lang}.yml"
Jekyll.langs[lang] = YAML.load_file("#{context.registers[:site].source}/_i18n/#{lang}.yml")
end
translation = Jekyll.langs[lang].access(key) if key.is_a?(String)
if translation.nil? or translation.empty?
translation = Jekyll.langs[context.registers[:site].config['default_lang']].access(key)
puts "Missing i18n key: #{lang}:#{key}"
puts "Using translation '%s' from default language: %s" %[translation, context.registers[:site].config['default_lang']]
end
translation
end
end
site = context.registers[:site]
module Tags
class LocalizeInclude < IncludeTag
def render(context)
if "#{context[@file]}" != "" #Check for page variable
file = "#{context[@file]}"
else
file = @file
end
stringsfile = File.join(site.source, '_strings_en.yml')
includes_dir = File.join(context.registers[:site].source, '_i18n/' + context.registers[:site].config['lang'])
strings_en = YAML.load_file(stringsfile)
if File.symlink?(includes_dir)
return "Includes directory '#{includes_dir}' cannot be a symlink"
end
if file !~ /^[a-zA-Z0-9_\/\.-]+$/ || file =~ /\.\// || file =~ /\/\./
return "Include file '#{file}' contains invalid characters or sequences"
end
translation = strings_en.access(key) if key.is_a?(String)
if translation.nil? || translation.empty?
Jekyll.logger.abort_with "Missing key: #{key}"
end
# If we have an @, pass the string through the markdown converter, so that we hit the Moneropedia plugin
if translation.include? '@'
converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
translation = converter.convert(translation)[3..-6]
end
Dir.chdir(includes_dir) do
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
if choices.include?(file)
source = File.read(file)
partial = Liquid::Template.parse(source)
translation
context.stack do
context['include'] = parse_params(context) if @params
contents = partial.render(context)
site = context.registers[:site]
ext = File.extname(file)
converter = site.converters.find { |c| c.matches(ext) }
contents = converter.convert(contents) unless converter.nil?
contents
end
else
"Included file '#{file}' not found in #{includes_dir} directory"
end
end
end
end
end
end
unless Hash.method_defined? :access
......@@ -68,3 +316,5 @@ end
Liquid::Template.register_tag('t', Jekyll::LocalizeTag)
Liquid::Template.register_tag('translate', Jekyll::LocalizeTag)
Liquid::Template.register_tag('tf', Jekyll::Tags::LocalizeInclude)
Liquid::Template.register_tag('translate_file', Jekyll::Tags::LocalizeInclude)
\ No newline at end of file
......@@ -9,9 +9,9 @@ icon: "icon_client"
attribution: "<!-- Icon is based on work by Freepik (http://www.freepik.com) and is licensed under Creative Commons BY 3.0 -->"
---
### Mobile, Web, and Lightweight Clients
### {% t gs.choose.mobile_web_lightweight %}