Merge pull request 'Put translations to sub directories' (#40) from trans-dirs into main

Reviewed-on: plume/joinplu.me#40
This commit is contained in:
KitaitiMakoto 2020-12-03 15:55:37 +00:00
commit dbc4182615
2 changed files with 4 additions and 3 deletions

View file

@ -5,11 +5,12 @@ TRANS_DIR = "trans"
desc "Build site"
multitask :build_site => [:build_base, "crowdin:download"] do
Pathname.glob("#{TRANS_DIR}/**/*.html.*").select(&:file?).each do |path|
Pathname.glob("#{TRANS_DIR}/**/*.html").select(&:file?).each do |path|
content = path.read
content.sub! /<script type="text\/javascript" src="\/\/cdn.crowdin.com\/jipt\/jipt.js"><\/script>/, ""
dest = Pathname(path.to_path.sub(TRANS_DIR, BUILD_DIR))
$stderr.puts "copy #{path} -> #{dest}"
dest.parent.mkpath
dest.write content
end
end

View file

@ -21,13 +21,13 @@ files: [
# Source files filter
# e.g. "/resources/en/*.json"
#
"source" : "/trans/**/*.html",
"source" : "/trans/index.html",
#
# Where translations will be placed
# e.g. "/resources/%two_letters_code%/%original_file_name%"
#
"translation" : "/trans/**/%original_file_name%.%two_letters_code%",
"translation" : "/trans/%two_letters_code%/%original_file_name%",
#
# Files or directories for ignore