Skip to content

Instantly share code, notes, and snippets.

@toshia
Last active September 5, 2016 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toshia/7dac0290e17eebac298390511ce30978 to your computer and use it in GitHub Desktop.
Save toshia/7dac0290e17eebac298390511ce30978 to your computer and use it in GitHub Desktop.
Transifexからファイルダウンロードしてきてmikutter上に反映するやつ
#! /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