i17n 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/i17n.rb +33 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 173cc043c2814119b0cb5754924fc68302feac972a7219b20023cc10efae9c34
|
4
|
+
data.tar.gz: 69620c92127e46864dc736cdde80f748b9e700497b6ee312bd14491018907648
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 714f1dcdc376a449c674d5d076f7eda2f169c9442206da07e01b104f9219374c373a757d4ad272af82240825cbec81d60b6863b418784c96e836f5c424f3d4c7
|
7
|
+
data.tar.gz: bbb6fd8a009b58b8893816923fbc10dfd4cbf19990a0bb435d1e17b3900eda0c73edef7ea610ba5947ea662b74248e93c198db4a556cc1a410359e7ccd35ee5d
|
data/lib/i17n.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module I17n
|
2
|
+
|
3
|
+
def self.t(*args)
|
4
|
+
if args[0].respond_to?(:model_name)
|
5
|
+
if args[1] && args[1].is_a?(Symbol)
|
6
|
+
args[0].human_attribute_name(*args.drop(1))
|
7
|
+
else
|
8
|
+
args[0].model_name.human(*args.drop(1))
|
9
|
+
end
|
10
|
+
elsif args[0].is_a?(Symbol)
|
11
|
+
I18n.t("app.#{args[0]}", *args.drop(1))
|
12
|
+
else
|
13
|
+
I18n.t(*args)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.method_missing(*args)
|
18
|
+
I18n.send(args[0], *args.drop(1))
|
19
|
+
end
|
20
|
+
|
21
|
+
module ControllerAdditive
|
22
|
+
extend ActiveSupport::Concern
|
23
|
+
|
24
|
+
included do
|
25
|
+
helper_method :t
|
26
|
+
end
|
27
|
+
|
28
|
+
def t(*args)
|
29
|
+
I17n.t(*args)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: i17n
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hisaya Nishide
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-20 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Just take a look at the code and you will see how it works.
|
14
|
+
email: hisayanishide@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/i17n.rb
|
20
|
+
homepage: https://github.com/hnishide/i17n
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.7.4
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: A helper to give a little shortcut for rails I18n
|
44
|
+
test_files: []
|