motion-i18n 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 648b5afbd3edf2e548189b72f7fe9d771f2980f9
4
+ data.tar.gz: 23a7f7a3b92daf628bed9a5e69416cd8a0f4d260
5
+ SHA512:
6
+ metadata.gz: d33e90b877f4e347955b9e510ac4b1520e0e141232d16cedf0437a11781dc7e3192d76cbb9704611d08df816f6d68c6d0a00c5c4697b7941e50c2a4d74b5b8ec
7
+ data.tar.gz: c0b737a01a4ad78a3ea6015363d17ccc97452ac6f9cf33d1b336a19c66e61ea37af1639a87e31bbb0b9a885fd8bd51faee38e5c40f2942a1051c3acc9ff7f019
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Thomas Kadauke
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-17 00:00:00.000000000 Z
11
+ date: 2015-11-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: motion-require
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: i18n
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -65,47 +58,28 @@ email:
65
58
  executables: []
66
59
  extensions: []
67
60
  extra_rdoc_files: []
68
- files:
69
- - .gitignore
70
- - Gemfile
71
- - README.md
72
- - Rakefile
73
- - app/app_delegate.rb
74
- - lib/motion-i18n.rb
75
- - lib/motion-i18n/i18n.rb
76
- - lib/tasks/translate.rb
77
- - motion-i18n.gemspec
78
- - resources/en.lproj/Localizable.strings
79
- - spec/motion-i18n/i18n_spec.rb
61
+ files: []
80
62
  homepage: https://github.com/tkadauke/motion-i18n
81
63
  licenses: []
64
+ metadata: {}
82
65
  post_install_message:
83
66
  rdoc_options: []
84
67
  require_paths:
85
68
  - lib
86
69
  required_ruby_version: !ruby/object:Gem::Requirement
87
- none: false
88
70
  requirements:
89
71
  - - ! '>='
90
72
  - !ruby/object:Gem::Version
91
73
  version: '0'
92
- segments:
93
- - 0
94
- hash: -2960334702810538327
95
74
  required_rubygems_version: !ruby/object:Gem::Requirement
96
- none: false
97
75
  requirements:
98
76
  - - ! '>='
99
77
  - !ruby/object:Gem::Version
100
78
  version: '0'
101
- segments:
102
- - 0
103
- hash: -2960334702810538327
104
79
  requirements: []
105
80
  rubyforge_project:
106
- rubygems_version: 1.8.25
81
+ rubygems_version: 2.2.2
107
82
  signing_key:
108
- specification_version: 3
83
+ specification_version: 4
109
84
  summary: Wrapper for translations in RubyMotion
110
- test_files:
111
- - spec/motion-i18n/i18n_spec.rb
85
+ test_files: []
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- .repl_history
2
- build
3
- resources/*.nib
4
- resources/*.momd
5
- resources/*.storyboardc
6
- *.gem
7
- .bundle
8
- Gemfile.lock
9
- pkg/*
10
- .dat*
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "motion-require"
4
-
5
- # Specify your gem's dependencies in motion-support.gemspec
6
- gemspec
data/README.md DELETED
@@ -1,63 +0,0 @@
1
- # MotionI18n
2
-
3
- Rails-style translations for RubyMotion apps.
4
-
5
- This gem allows you to specify your RubyMotion translations as `.yml` files. The translations are automatically converted to Cocoa's native format for translations.
6
-
7
- # Installation
8
-
9
- ```
10
- gem install motion-i18n
11
- ```
12
-
13
- and in your `Rakefile`:
14
-
15
- ```ruby
16
- require 'motion-i18n'
17
- ```
18
-
19
- or using bundler:
20
-
21
- ```ruby
22
- gem "motion-i18n"
23
- ```
24
-
25
- # Usage
26
-
27
- Put your translations in YAML files in `config/locales/`. For each locale there should be a file named as the locale with the extension `.yml`, e.g. `en.yml`, `de.yml` etc.
28
-
29
- ## Translations
30
-
31
- For a guide on how the translation files should look like, see <http://guides.rubyonrails.org/i18n.html#adding-translations>
32
-
33
- To translate a string, use `I18n.translate` or the shortcut `I18n.t` like this:
34
-
35
- ```ruby
36
- I18n.t("main_screen.title")
37
- ```
38
-
39
- To substitute variables in the string, specify the substitutions in second a hash argument
40
-
41
- ```ruby
42
- I18n.t("maps.directions", :from => origin, :to => destination)
43
- ```
44
-
45
- ## Locale
46
-
47
- You can get the current locale by calling
48
-
49
- ```ruby
50
- I18n.locale
51
- ```
52
-
53
- # Warning
54
-
55
- For each locale `loc`, this gem overwrites the file `resources/loc.lproj/Localizable.strings` before building. Make sure you don't edit this file. Also, you should add these files to `.gitignore`:
56
-
57
- ```
58
- Localizable.strings
59
- ```
60
-
61
- # Forking
62
-
63
- Feel free to fork and submit pull requests!
data/Rakefile DELETED
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env rake
2
- $:.unshift("/Library/RubyMotion/lib")
3
- require 'motion/project'
4
- require "bundler/gem_tasks"
5
- Bundler.setup
6
- Bundler.require
7
-
8
- require 'motion-i18n'
9
-
10
- Motion::Project::App.setup do |app|
11
- # Use `rake config' to see complete project settings.
12
- app.name = 'MotionI18n'
13
- end
data/app/app_delegate.rb DELETED
@@ -1,7 +0,0 @@
1
- class AppDelegate
2
- def application(application, didFinishLaunchingWithOptions:launchOptions)
3
- @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
4
- @window.rootViewController = UIViewController.alloc.init
5
- true
6
- end
7
- end
@@ -1,16 +0,0 @@
1
- module I18n
2
- class << self
3
- def translate(key, substitutions = {})
4
- String.new((NSBundle.mainBundle.localizedStringForKey(key, value:"", table:nil))).tap do |result|
5
- substitutions.each do |key, value|
6
- result.sub!("%{#{key}}", value.to_s)
7
- end
8
- end
9
- end
10
- alias t translate
11
-
12
- def locale
13
- NSLocale.preferredLanguages.first
14
- end
15
- end
16
- end
data/lib/motion-i18n.rb DELETED
@@ -1,4 +0,0 @@
1
- require 'motion-require'
2
- require 'tasks/translate'
3
-
4
- Motion::Require.all(Dir.glob(File.expand_path('../motion-i18n/**/*.rb', __FILE__)))
@@ -1,36 +0,0 @@
1
- def convert(file, namespace, value)
2
- if value.is_a?(Hash)
3
- value.each do |key, value|
4
- convert(file, "#{namespace}.#{key}", value)
5
- end
6
- else
7
- file.puts %{"#{namespace}" = "#{value.to_s}";}
8
- end
9
- end
10
-
11
- desc "Convert YAML translations to Localizable.strings format"
12
- task :translate do
13
- require 'i18n'
14
-
15
- files = Dir.glob("config/locales/*.yml")
16
-
17
- I18n.load_path.clear
18
- I18n.load_path << files
19
-
20
- files.each do |locale_file|
21
- locale = File.basename(locale_file).sub(".yml", "")
22
-
23
- all_translations = I18n.backend.send(:lookup, locale.to_sym, "")
24
- FileUtils.mkdir_p("resources/#{locale}.lproj")
25
- File.open("resources/#{locale}.lproj/Localizable.strings", 'w') do |file|
26
- all_translations.each do |key, value|
27
- convert(file, key, value)
28
- end
29
- end
30
- end
31
- end
32
-
33
- namespace :build do
34
- task :simulator => :translate
35
- task :device => :translate
36
- end
data/motion-i18n.gemspec DELETED
@@ -1,18 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- Gem::Specification.new do |s|
3
- s.name = "motion-i18n"
4
- s.version = "0.0.2"
5
- s.authors = ["Thomas Kadauke"]
6
- s.email = ["thomas.kadauke@googlemail.com"]
7
- s.homepage = "https://github.com/tkadauke/motion-i18n"
8
- s.summary = "Wrapper for translations in RubyMotion"
9
- s.description = "Wrapper for translations in RubyMotion"
10
-
11
- s.files = `git ls-files`.split($\)
12
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
13
- s.require_paths = ["lib"]
14
-
15
- s.add_dependency 'motion-require'
16
- s.add_dependency 'i18n'
17
- s.add_development_dependency 'rake'
18
- end
@@ -1,2 +0,0 @@
1
- "test.string" = "Test string";
2
- "test.substitutions" = "%{count} substitutions";
@@ -1,25 +0,0 @@
1
- describe "I18n" do
2
- describe "translate" do
3
- it "should translate string" do
4
- I18n.translate("test.string").should == "Test string"
5
- end
6
-
7
- it "should return key for untranslated string" do
8
- I18n.translate("foo.bar").should == "foo.bar"
9
- end
10
-
11
- it "should plug in substitutions" do
12
- I18n.translate("test.substitutions", :count => 5).should == "5 substitutions"
13
- end
14
-
15
- it "should have shortcut" do
16
- I18n.t("test.string").should == I18n.translate("test.string")
17
- end
18
- end
19
-
20
- describe "locale" do
21
- it "should return the current locale" do
22
- I18n.locale.should == "en"
23
- end
24
- end
25
- end