Last active
September 5, 2016 14:20
-
-
Save toshia/7dac0290e17eebac298390511ce30978 to your computer and use it in GitHub Desktop.
Transifexからファイルダウンロードしてきてmikutter上に反映するやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/ruby | |
# -*- coding: utf-8 -*- | |
=begin rdoc | |
==== How to use | |
1. Put this file in mikutter.rb directory (ex: /usr/local/share/mikutter) | |
2. Go to the directory. | |
3. tx init tx/ | |
4. cd tx | |
5. tx set --auto-remote https://www.transifex.com/projects/p/mikutter/ | |
6. tx pull -a | |
7. cd ../ | |
8. Run this script | |
=end | |
require 'fileutils' | |
Dir.glob(File.join(__dir__, "tx/translations/*")) do |dir| | |
slug = File.basename(dir).split('.').last | |
next if 'readme' == slug | |
slug = 'setting' if slug == 'setting-1' | |
Dir.glob(File.join(dir, '*.po')).map{ |po| File.basename(po, '.po') }.each do |lang| | |
dest_dir = File.join(__dir__, "core/plugin/#{slug}/po/#{lang}/") | |
FileUtils.mkdir_p(File.join(__dir__, "core/plugin/#{slug}/po/#{lang}/")) | |
FileUtils.cp(File.join(dir, lang+'.po'), File.join(dest_dir, "#{slug}.po")) | |
p [File.join(dir, lang+'.po'), dest_dir] | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment