i18n-one_sky 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/CHANGELOG +5 -0
- data/CREDITS +6 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +40 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +59 -0
- data/Rakefile +13 -0
- data/i18n-one_sky.gemspec +28 -0
- data/lib/generators/one_sky/init/init_generator.rb +30 -0
- data/lib/i18n-one_sky/rails/railtie.rb +9 -0
- data/lib/i18n-one_sky/rails/tasks/i18n-one_sky.rake +17 -0
- data/lib/i18n-one_sky/simple_client.rb +133 -0
- data/lib/i18n-one_sky/version.rb +5 -0
- data/lib/i18n-one_sky.rb +10 -0
- data/spec/data/en.yml +15 -0
- data/spec/helpers.rb +22 -0
- data/spec/simple_client_spec.rb +58 -0
- metadata +158 -0
data/.gitignore
ADDED
data/CHANGELOG
ADDED
data/CREDITS
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
i18n-one_sky (0.0.1)
|
5
|
+
i18n (~> 0.5.0)
|
6
|
+
one_sky (~> 0.0.1)
|
7
|
+
thor (~> 0.14.4)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
diff-lcs (1.1.2)
|
13
|
+
i18n (0.5.0)
|
14
|
+
json (1.4.6)
|
15
|
+
mime-types (1.16)
|
16
|
+
one_sky (0.0.1)
|
17
|
+
json (~> 1.4.6)
|
18
|
+
rest-client (~> 1.6.1)
|
19
|
+
rest-client (1.6.1)
|
20
|
+
mime-types (>= 1.16)
|
21
|
+
rspec (2.2.0)
|
22
|
+
rspec-core (~> 2.2)
|
23
|
+
rspec-expectations (~> 2.2)
|
24
|
+
rspec-mocks (~> 2.2)
|
25
|
+
rspec-core (2.2.1)
|
26
|
+
rspec-expectations (2.2.0)
|
27
|
+
diff-lcs (~> 1.1.2)
|
28
|
+
rspec-mocks (2.2.0)
|
29
|
+
thor (0.14.6)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
bundler (~> 1.0.0)
|
36
|
+
i18n (~> 0.5.0)
|
37
|
+
i18n-one_sky!
|
38
|
+
one_sky (~> 0.0.1)
|
39
|
+
rspec (~> 2.2.0)
|
40
|
+
thor (~> 0.14.4)
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010-2011 {OneSky, Inc.}[link:http://www.oneskyapp.com]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
= I18n OneSky
|
2
|
+
|
3
|
+
OneSky[link:http://www.oneskyapp.com] is a new service that lets developers reach a global audience by easily enabling them to translate their websites and applications to different languages through the help of the community.
|
4
|
+
|
5
|
+
This gem integrates OneSky and I18n. At its most basic, it allows you to take the phrases defined under I18n's default locale and upload them to OneSky[link:http://www.oneskyapp.com] for translation by the community. Afterwards, you can download available translations and save them as Simple backend YAML files.
|
6
|
+
|
7
|
+
= Using inside a Rails project
|
8
|
+
|
9
|
+
In your Rails root, edit your Gemfile to include this gem:
|
10
|
+
|
11
|
+
# Gemfile
|
12
|
+
gem 'rails', '3.0.3'
|
13
|
+
...
|
14
|
+
gem 'i18n-one_sky'
|
15
|
+
|
16
|
+
Then tell Bundler to install:
|
17
|
+
|
18
|
+
bundle install
|
19
|
+
|
20
|
+
If you haven't done so yet, log in to your account at OneSky[link:http://www.oneskyapp.com] and create a new project for this Rails app. Also, find the API key and secret which you will supply here:
|
21
|
+
|
22
|
+
rails generate one_sky:init my_api_key my_api_secret my_project
|
23
|
+
|
24
|
+
This will create the configuration file config/one_sky.yml.
|
25
|
+
|
26
|
+
So assuming that you already have your phrases defined for your default locale and all your views contain the ubiquitous t() methods, it's time now to submit these phrases to OneSky:
|
27
|
+
|
28
|
+
rake one_sky:upload_phrases
|
29
|
+
|
30
|
+
Then ask your translators to provide the translations using the OneSky[link:http://www.oneskyapp.com] website. When they're done and a few new languages are available, download them by:
|
31
|
+
|
32
|
+
rake one_sky:download_translations
|
33
|
+
|
34
|
+
This will save the translations inside config/locales/*_one_sky.yml files. You now have more languages supported and it's just a matter of pushing again to production. You can call upload and download over and over as you incrementally internationalize your site.
|
35
|
+
|
36
|
+
= Using outside Rails
|
37
|
+
|
38
|
+
Although I18n is commonly known as the default internationalization module for Rails, it actually is designed to be used outside Rails, too. And so is i18n-one_sky.
|
39
|
+
|
40
|
+
Install it like any regular gem:
|
41
|
+
|
42
|
+
gem install i18n-one_sky
|
43
|
+
|
44
|
+
And see I18n::OneSky::SimpleClient for the methods available in Ruby.
|
45
|
+
|
46
|
+
= History
|
47
|
+
|
48
|
+
See CHANGELOG[link:CHANGELOG.html]
|
49
|
+
|
50
|
+
= Credits
|
51
|
+
|
52
|
+
See CREDITS[link:CREDITS.html]
|
53
|
+
|
54
|
+
= License
|
55
|
+
|
56
|
+
Copyright 2010-2011 {OneSky, Inc.}[link:http://www.oneskyapp.com]
|
57
|
+
|
58
|
+
Licensed under the {MIT License}[link:MIT-LICENSE.html].
|
59
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
# = RDoc
|
5
|
+
require 'rake/rdoctask'
|
6
|
+
|
7
|
+
Rake::RDocTask.new do |t|
|
8
|
+
t.rdoc_dir = 'rdoc'
|
9
|
+
t.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
10
|
+
t.options << '--charset' << 'utf-8'
|
11
|
+
t.rdoc_files.include('README.rdoc', 'MIT-LICENSE', 'CHANGELOG', 'CREDITS', 'lib/**/*.rb')
|
12
|
+
end
|
13
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "i18n-one_sky/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "i18n-one_sky"
|
7
|
+
s.version = I18n::Onesky::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Junjun Olympia"]
|
10
|
+
s.email = ["romeo.olympia@gmail.com"]
|
11
|
+
s.homepage = "http://rubygems.org/gems/i18n-one_sky"
|
12
|
+
s.summary = %q{I18n extensions using OneSky -- the community-powered translation service.}
|
13
|
+
s.description = %q{A set of I18n extensions that use OneSky. At its most basic, this allows you to easily submit translation requests to the OneSky service and download available translations as Simple backend YAML files.}
|
14
|
+
|
15
|
+
s.rubyforge_project = "i18n-one_sky"
|
16
|
+
|
17
|
+
s.add_dependency "i18n", "~> 0.5.0"
|
18
|
+
s.add_dependency "one_sky", "~> 0.0.1"
|
19
|
+
s.add_dependency "thor", "~> 0.14.4"
|
20
|
+
|
21
|
+
s.add_development_dependency "rspec", "~> 2.2.0"
|
22
|
+
s.add_development_dependency "bundler", "~> 1.0.0"
|
23
|
+
|
24
|
+
s.files = `git ls-files`.split("\n")
|
25
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
26
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module OneSky
|
2
|
+
module Generators
|
3
|
+
class InitGenerator < ::Rails::Generators::Base
|
4
|
+
desc "This generator configures i18n-one_sky for use on this Rails project."
|
5
|
+
argument :api_key, :type => :string, :desc => "The API key you got from OneSky"
|
6
|
+
argument :api_secret, :type => :string, :desc => "The API secret you got from OneSky"
|
7
|
+
argument :project, :type => :string, :desc => "The name of the OneSky project"
|
8
|
+
class_option :force, :type => :boolean, :default => false, :desc => "Overwrite if config file already exists"
|
9
|
+
@@config_file = [Rails.root.to_s, 'config', 'one_sky.yml'].join('/')
|
10
|
+
|
11
|
+
def remove_config_file
|
12
|
+
if File.exists? @@config_file
|
13
|
+
if options.force?
|
14
|
+
say_status("warning", "config file already exists and is being overwritten.", :yellow)
|
15
|
+
remove_file @@config_file
|
16
|
+
else
|
17
|
+
say_status("error", "config file already exists. Use --force to overwrite.", :red)
|
18
|
+
raise "Error: OneSky config file exists."
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_config_file
|
24
|
+
config_hash = {"api_key" => api_key, "api_secret" => api_secret, "project" => project}
|
25
|
+
create_file(@@config_file, config_hash.to_yaml)
|
26
|
+
say_status("info", "config file #{@@config_file} created.", :green)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
namespace :one_sky do
|
2
|
+
desc "Upload phrases for translation to OneSky."
|
3
|
+
task :upload_phrases => :environment do
|
4
|
+
client = I18n::OneSky::SimpleClient.new
|
5
|
+
puts "Default locale for this Rails app is: #{I18n.default_locale}"
|
6
|
+
puts client.load_phrases
|
7
|
+
client.upload_phrases
|
8
|
+
puts "Phrases uploaded to OneSky. Please ask your translators to... well... get translating."
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "Download available translations from OneSky."
|
12
|
+
task :download_translations do
|
13
|
+
client = I18n::OneSky::SimpleClient.new
|
14
|
+
client.download_translations
|
15
|
+
puts "Translations downloaded and saved to config/locales/*_one_sky.yml files."
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
module I18n
|
2
|
+
module OneSky
|
3
|
+
# This class is the bridge between the OneSky service and the I18n Simple backend.
|
4
|
+
# It takes the phrases defined in I18n's default locale and uploads them to OneSky for translation.
|
5
|
+
# Then it downloads available translations and saves them as Simple backend's YAML files.
|
6
|
+
# A regular workflow would then look like:
|
7
|
+
# initialize -> load_phrases -> upload_phrases -> download_translations
|
8
|
+
class SimpleClient
|
9
|
+
include I18n::Backend::Flatten
|
10
|
+
|
11
|
+
attr_reader :phrases_nested, :phrases_flat
|
12
|
+
# The base OneSky project. Gives you low-level access to the API gem.
|
13
|
+
attr_reader :project
|
14
|
+
|
15
|
+
# When you initialize a client inside a Rails project, it will take the OneSky configuration variables supplied when you called rails generate one_sky:init.
|
16
|
+
# Outside of Rails, credentials are expected to come from environment variables: ONESKY_API_KEY, ONESKY_API_SECRET, ONESKY_PROJECT.
|
17
|
+
# You can override these defaults by providing a hash of options:
|
18
|
+
# * api_key
|
19
|
+
# * api_secret
|
20
|
+
# * project
|
21
|
+
def initialize(options = {})
|
22
|
+
options = default_options.merge!(options)
|
23
|
+
@project = ::OneSky::Project.new(options[:api_key], options[:api_secret], options[:project])
|
24
|
+
@one_sky_locale = @project.details["original_lang_code"].to_s
|
25
|
+
check_default_locales_match
|
26
|
+
@one_sky_languages = @project.languages
|
27
|
+
end
|
28
|
+
|
29
|
+
# This will load the phrases defined for I18n's default locale.
|
30
|
+
# If not a Rails project, manually supply the path where the I18n yml or rb files for located.
|
31
|
+
def load_phrases(path=nil)
|
32
|
+
if defined? Rails
|
33
|
+
I18n.backend.load_translations
|
34
|
+
else
|
35
|
+
raise ArgumentError, "Please supply the path where locales are located." unless path
|
36
|
+
path = path.chop if path =~ /\/$/
|
37
|
+
I18n.backend.load_translations(*Dir.glob("#{path}/**/*.{yml,rb}"))
|
38
|
+
end
|
39
|
+
|
40
|
+
@phrases_nested = I18n.backend.instance_variable_get("@translations")[I18n.default_locale]
|
41
|
+
|
42
|
+
# Flatten the nested hash.
|
43
|
+
flat_keys = flatten_translations(I18n.default_locale, @phrases_nested, true, false)
|
44
|
+
|
45
|
+
# Remove those "supporting/generic" i18n entities that we're not sending to OneSky.
|
46
|
+
# Those that are found in the rails-i18n github repository.
|
47
|
+
# Eg. number, datetime, activemodel, etc.
|
48
|
+
# Note: This doesn't handle FLATTEN_SEPARATOR other than '.' yet.
|
49
|
+
patterns = %w{number datetime activemodel support activerecord date time errors helpers}.inject([]) { |o,e| o << Regexp.new("^#{e}(\\..*)?$") }
|
50
|
+
@phrases_flat = flat_keys.reject { |k,v| patterns.find { |e| k.to_s =~ e } }
|
51
|
+
end
|
52
|
+
|
53
|
+
# Once you've loaded the default locale's phrases, call this method to send them to OneSky for translation.
|
54
|
+
def upload_phrases
|
55
|
+
load_phrases unless @phrases_flat
|
56
|
+
|
57
|
+
batch_requests = @phrases_flat.inject([]) do |o,(k,v)|
|
58
|
+
# ToDo: Materialize ALL CLDR plural tags if at least one is present for a leaf node.
|
59
|
+
o << {:string_key => k, :string => v}
|
60
|
+
end
|
61
|
+
|
62
|
+
@project.input_bulk(batch_requests)
|
63
|
+
end
|
64
|
+
|
65
|
+
# When your translators are done, call this method to download all available translations and save them as Simple backend *.yml files.
|
66
|
+
# Outside of Rails, manually supply the path where downloaded files should be saved.
|
67
|
+
def download_translations(path=nil)
|
68
|
+
if defined? Rails
|
69
|
+
path ||= [Rails.root.to_s, "config", "locales"].join("/")
|
70
|
+
else
|
71
|
+
raise ArgumentError, "Please supply the path where locales are to be downloaded." unless path
|
72
|
+
path = path.chop if path =~ /\/$/
|
73
|
+
end if
|
74
|
+
|
75
|
+
output = @project.output
|
76
|
+
|
77
|
+
# Let's ignore other hash nodes from the API and just rely on the string keys we sent during upload. Prefix with locale.
|
78
|
+
@translations = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) }
|
79
|
+
output.map do |k0,v0| # Page level
|
80
|
+
v0.map do |k1, v1| # Locale level
|
81
|
+
v1.map do |k2, v2| # string key level
|
82
|
+
@translations[k1][[k1, k2].join('.')] = v2
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Delete all existing one_sky translation files before downloading a new set.
|
88
|
+
File.delete(*Dir.glob("#{path}/*_one_sky.yml"))
|
89
|
+
|
90
|
+
# Process each locale and save to file
|
91
|
+
@translations.map { |k,v| save_locale(k, v, "#{path}/#{k}_one_sky.yml") unless k.to_s == @one_sky_locale }
|
92
|
+
end
|
93
|
+
|
94
|
+
protected
|
95
|
+
|
96
|
+
def save_locale(lang_code, phrases, filename)
|
97
|
+
nested = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) }
|
98
|
+
phrases.map do |k,v|
|
99
|
+
node = nested
|
100
|
+
parts = k.split('.')
|
101
|
+
parts.each_with_index { |segment,i| node[segment]; i == parts.size - 1 ? node[segment] = v : node = node[segment] }
|
102
|
+
end
|
103
|
+
|
104
|
+
lang = @one_sky_languages.find { |e| e["lang_code"] == lang_code }
|
105
|
+
|
106
|
+
File.open(filename, 'w') do |f|
|
107
|
+
f.puts "# PLEASE DO NOT EDIT THIS FILE."
|
108
|
+
f.puts "# This was downloaded from OneSky. Log in to your OneSky account to manage translations on their website."
|
109
|
+
f.puts "# Language code: #{lang['lang_code']}"
|
110
|
+
f.puts "# Language name: #{lang['name']}"
|
111
|
+
f.puts "# Language English name: #{lang['eng_name']}"
|
112
|
+
f.print(nested.to_yaml)
|
113
|
+
end
|
114
|
+
filename
|
115
|
+
end
|
116
|
+
|
117
|
+
def default_options
|
118
|
+
if defined? Rails
|
119
|
+
YAML.load_file([Rails.root.to_s, 'config', 'one_sky.yml'].join('/')).symbolize_keys
|
120
|
+
else
|
121
|
+
{:api_key => ENV["ONESKY_API_KEY"], :api_secret => ENV["ONESKY_API_SECRET"], :project => ENV["ONESKY_PROJECT"]}
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def check_default_locales_match
|
126
|
+
# Special case: i18n "en" is "en-us".
|
127
|
+
i18n_default_locale = I18n.default_locale == :en ? "en-us" : I18n.default_locale.to_s.downcase
|
128
|
+
raise DefaultLocaleMismatchError, "I18n and OneSky have different default locale settings. #{I18n.default_locale.to_s} <> #{@one_sky_locale}" if i18n_default_locale != @one_sky_locale.downcase
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
data/lib/i18n-one_sky.rb
ADDED
data/spec/data/en.yml
ADDED
data/spec/helpers.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
|
4
|
+
require 'i18n-one_sky'
|
5
|
+
|
6
|
+
module I18nOneSkySpecHelpers
|
7
|
+
def create_simple_client
|
8
|
+
raise "Please set environment variables: ONESKY_API_KEY, ONESKY_API_SECRET and ONESKY_SPEC_PROJ (default: i18noneskyspec) before running spec." unless [ENV["ONESKY_API_KEY"], ENV["ONESKY_API_SECRET"]].all?
|
9
|
+
I18n.default_locale = :en
|
10
|
+
client = I18n::OneSky::SimpleClient.new(
|
11
|
+
:api_key => ENV["ONESKY_API_KEY"],
|
12
|
+
:api_secret => ENV["ONESKY_API_SECRET"],
|
13
|
+
:project => ENV["ONESKY_SPEC_PROJ"] || "i18noneskyspec"
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_simple_client_and_load
|
18
|
+
client = create_simple_client
|
19
|
+
client.load_phrases([File.dirname(__FILE__), "data"].join('/'))
|
20
|
+
client
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'helpers'
|
2
|
+
|
3
|
+
describe "SimpleClient" do
|
4
|
+
|
5
|
+
it "raises an error when initialization values are nil." do
|
6
|
+
lambda { @client = I18n::OneSky::SimpleClient.new(:api_key => nil, :api_secret => nil, :project => nil) }.should raise_error ArgumentError
|
7
|
+
end
|
8
|
+
|
9
|
+
it "raises an error when OneSky and I18n default locales do not match." do
|
10
|
+
I18n.default_locale = :th
|
11
|
+
lambda { @client = I18n::OneSky::SimpleClient.new(:project => ENV["ONESKY_SPEC_PROJ"]) }.should raise_error I18n::OneSky::DefaultLocaleMismatchError
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "SimpleClient" do
|
16
|
+
include I18nOneSkySpecHelpers
|
17
|
+
|
18
|
+
before do
|
19
|
+
@client = create_simple_client_and_load
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#load_phrases" do
|
23
|
+
it "should load nested phrases." do
|
24
|
+
@client.phrases_nested[:my_pages][:page][:title].should == "My Page Title"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should load flattened phrases." do
|
28
|
+
@client.phrases_flat[:'my_pages.page.title'].should == "My Page Title"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should not load excluded sections." do
|
32
|
+
@client.phrases_flat[:'number.currency.format.unit'].should be_nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#upload_phrases" do
|
37
|
+
it "returns true." do
|
38
|
+
@client.upload_phrases.should be_true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "SimpleClient" do
|
44
|
+
include I18nOneSkySpecHelpers
|
45
|
+
|
46
|
+
before do
|
47
|
+
@client = create_simple_client
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#download_translations" do
|
51
|
+
path = [File.dirname(__FILE__), 'data'].join('/')
|
52
|
+
it "saves translation files." do
|
53
|
+
@client.download_translations(path).should be_a_kind_of Array
|
54
|
+
Dir.glob("#{path}/*_one_sky.yml").size.should >= 1
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: i18n-one_sky
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Junjun Olympia
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-01-03 00:00:00 +08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: i18n
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
- 5
|
31
|
+
- 0
|
32
|
+
version: 0.5.0
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: one_sky
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
- 0
|
46
|
+
- 1
|
47
|
+
version: 0.0.1
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: thor
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ~>
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
- 14
|
61
|
+
- 4
|
62
|
+
version: 0.14.4
|
63
|
+
type: :runtime
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: rspec
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ~>
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
segments:
|
74
|
+
- 2
|
75
|
+
- 2
|
76
|
+
- 0
|
77
|
+
version: 2.2.0
|
78
|
+
type: :development
|
79
|
+
version_requirements: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: bundler
|
82
|
+
prerelease: false
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ~>
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
segments:
|
89
|
+
- 1
|
90
|
+
- 0
|
91
|
+
- 0
|
92
|
+
version: 1.0.0
|
93
|
+
type: :development
|
94
|
+
version_requirements: *id005
|
95
|
+
description: A set of I18n extensions that use OneSky. At its most basic, this allows you to easily submit translation requests to the OneSky service and download available translations as Simple backend YAML files.
|
96
|
+
email:
|
97
|
+
- romeo.olympia@gmail.com
|
98
|
+
executables: []
|
99
|
+
|
100
|
+
extensions: []
|
101
|
+
|
102
|
+
extra_rdoc_files: []
|
103
|
+
|
104
|
+
files:
|
105
|
+
- .gitignore
|
106
|
+
- CHANGELOG
|
107
|
+
- CREDITS
|
108
|
+
- Gemfile
|
109
|
+
- Gemfile.lock
|
110
|
+
- MIT-LICENSE
|
111
|
+
- README.rdoc
|
112
|
+
- Rakefile
|
113
|
+
- i18n-one_sky.gemspec
|
114
|
+
- lib/generators/one_sky/init/init_generator.rb
|
115
|
+
- lib/i18n-one_sky.rb
|
116
|
+
- lib/i18n-one_sky/rails/railtie.rb
|
117
|
+
- lib/i18n-one_sky/rails/tasks/i18n-one_sky.rake
|
118
|
+
- lib/i18n-one_sky/simple_client.rb
|
119
|
+
- lib/i18n-one_sky/version.rb
|
120
|
+
- spec/data/en.yml
|
121
|
+
- spec/helpers.rb
|
122
|
+
- spec/simple_client_spec.rb
|
123
|
+
has_rdoc: true
|
124
|
+
homepage: http://rubygems.org/gems/i18n-one_sky
|
125
|
+
licenses: []
|
126
|
+
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
segments:
|
138
|
+
- 0
|
139
|
+
version: "0"
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
segments:
|
146
|
+
- 0
|
147
|
+
version: "0"
|
148
|
+
requirements: []
|
149
|
+
|
150
|
+
rubyforge_project: i18n-one_sky
|
151
|
+
rubygems_version: 1.3.7
|
152
|
+
signing_key:
|
153
|
+
specification_version: 3
|
154
|
+
summary: I18n extensions using OneSky -- the community-powered translation service.
|
155
|
+
test_files:
|
156
|
+
- spec/data/en.yml
|
157
|
+
- spec/helpers.rb
|
158
|
+
- spec/simple_client_spec.rb
|