locale_js 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/README.markdown +59 -0
- data/app/controllers/.DS_Store +0 -0
- data/app/controllers/{locale_controller.rb → locale_js/locale_controller.rb} +1 -1
- data/app/views/.DS_Store +0 -0
- data/config/routes.rb +1 -1
- data/lib/locale_js/engine.rb +2 -2
- data/lib/locale_js/version.rb +2 -2
- data/locale_js.gemspec +1 -1
- data/spec/locale_js_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +12 -10
- data/README.rdoc +0 -26
data/.gitignore
CHANGED
data/README.markdown
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Locale JS
|
2
|
+
|
3
|
+
A fairly simple rails engine that takes your Rails locale and makes it available
|
4
|
+
in your Javascript.
|
5
|
+
All you have to do is add this to your Gemfile, mount the engine and include the javascript locale in
|
6
|
+
your page.
|
7
|
+
|
8
|
+
## Examples
|
9
|
+
|
10
|
+
add the gem to your Gemfile
|
11
|
+
|
12
|
+
```
|
13
|
+
gem 'locale_js'
|
14
|
+
```
|
15
|
+
|
16
|
+
mount the engine in our routes.rb
|
17
|
+
|
18
|
+
```
|
19
|
+
mount LocaleJs::Engine => '/i18n'
|
20
|
+
```
|
21
|
+
|
22
|
+
then add this to your application layout
|
23
|
+
|
24
|
+
```
|
25
|
+
<script src="/i18n/locale/<%= I18n.locale %>.js"></script>
|
26
|
+
```
|
27
|
+
|
28
|
+
Populate your locale file as normal..
|
29
|
+
|
30
|
+
```
|
31
|
+
en:
|
32
|
+
hello: "Hello World"
|
33
|
+
foo: "%{foo} test"
|
34
|
+
bar:
|
35
|
+
baz: "The craic is %{craic}"
|
36
|
+
```
|
37
|
+
|
38
|
+
You can then translate strings in your JS just like I18n...
|
39
|
+
|
40
|
+
```
|
41
|
+
I18n.t('hello')
|
42
|
+
=> 'Hello World'
|
43
|
+
|
44
|
+
I18n.t('foo', {foo: 'bar'})
|
45
|
+
=> 'bar test'
|
46
|
+
|
47
|
+
I18n.t('bar.baz', {craic: 'mighty!'})
|
48
|
+
=> 'The craic is mighty!'
|
49
|
+
```
|
50
|
+
|
51
|
+
## Requirements
|
52
|
+
|
53
|
+
Rails 3.0 or greater
|
54
|
+
|
55
|
+
## Copyright
|
56
|
+
|
57
|
+
Copyright (c) 2012 John Butler
|
58
|
+
|
59
|
+
See LICENSE.txt for details.
|
Binary file
|
data/app/views/.DS_Store
ADDED
Binary file
|
data/config/routes.rb
CHANGED
data/lib/locale_js/engine.rb
CHANGED
data/lib/locale_js/version.rb
CHANGED
data/locale_js.gemspec
CHANGED
@@ -4,7 +4,7 @@ require File.expand_path('../lib/locale_js/version', __FILE__)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "locale_js"
|
7
|
-
gem.version =
|
7
|
+
gem.version = LocaleJs::VERSION
|
8
8
|
gem.summary = %q{Make Rails i18n available in javascript}
|
9
9
|
gem.description = %q{Make Rails i18n available in javascript}
|
10
10
|
gem.license = "MIT"
|
data/spec/locale_js_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locale_js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-28 00:00:00.000000000 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubygems-tasks
|
17
|
-
requirement: &
|
17
|
+
requirement: &70352734811280 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0.2'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70352734811280
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rdoc
|
28
|
-
requirement: &
|
28
|
+
requirement: &70352734810760 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '3.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70352734810760
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rspec
|
39
|
-
requirement: &
|
39
|
+
requirement: &70352734810020 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: '2.4'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70352734810020
|
48
48
|
description: Make Rails i18n available in javascript
|
49
49
|
email:
|
50
50
|
executables: []
|
@@ -56,10 +56,12 @@ files:
|
|
56
56
|
- .rspec
|
57
57
|
- ChangeLog.rdoc
|
58
58
|
- LICENSE.txt
|
59
|
-
- README.
|
59
|
+
- README.markdown
|
60
60
|
- Rakefile
|
61
61
|
- app/.DS_Store
|
62
|
-
- app/controllers
|
62
|
+
- app/controllers/.DS_Store
|
63
|
+
- app/controllers/locale_js/locale_controller.rb
|
64
|
+
- app/views/.DS_Store
|
63
65
|
- app/views/locale/i18n.js.erb
|
64
66
|
- config/routes.rb
|
65
67
|
- lib/locale_js.rb
|
data/README.rdoc
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
= locale_js
|
2
|
-
|
3
|
-
* {Homepage}[https://rubygems.org/gems/locale_js]
|
4
|
-
* {Documentation}[http://rubydoc.info/gems/locale_js/frames]
|
5
|
-
|
6
|
-
== Description
|
7
|
-
|
8
|
-
TODO: Description
|
9
|
-
|
10
|
-
== Features
|
11
|
-
|
12
|
-
== Examples
|
13
|
-
|
14
|
-
require 'locale_js'
|
15
|
-
|
16
|
-
== Requirements
|
17
|
-
|
18
|
-
== Install
|
19
|
-
|
20
|
-
$ gem install locale_js
|
21
|
-
|
22
|
-
== Copyright
|
23
|
-
|
24
|
-
Copyright (c) 2012 jbutler
|
25
|
-
|
26
|
-
See LICENSE.txt for details.
|