hanami-i18n 0.1.1

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
+ SHA256:
3
+ metadata.gz: a22c9aa18a54d0afb2db554c3d03b048ba4fd7f12e1f244b4761acd4de8292d7
4
+ data.tar.gz: 9f1807800e93d74f5a4c813ca2e07a9e84cda0a59e34579edac055dcee22d056
5
+ SHA512:
6
+ metadata.gz: 8ebed58d20e27678580cdf7f3da375edc66bcbb0932f282a3d064d5881ec24629713175784a915fedb8ab67ac65c4cd1e183ecbe64e10064dfee57c5b7e4e643
7
+ data.tar.gz: 69c51f597f40ffc5f107a419d91dffcf7d384418921a8831a42633f10028a56a63d30676f2932a50c2d59c05d6b17e2043fbb3839356936f12b892838ba18eaa
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /vendor/bundle
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'vendor/**/*'
4
+ - 'hanami-i18n.gemspec'
5
+ - 'spec/**/*'
6
+ - 'test/**/*'
7
+ - 'bin/**/*'
8
+ - 'Rakefile'
9
+ - 'Gemfile'
10
+ TargetRubyVersion: 2.5
11
+
12
+ Style/Documentation:
13
+ Enabled: false
14
+
15
+ Style/ClassAndModuleChildren:
16
+ Enabled: false
data/.rubocop_todo.yml ADDED
File without changes
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.0
5
+ before_install: gem install bundler -v 1.16.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ivalice1218@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in hanami-i18n.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,132 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hanami-i18n (0.1.1)
5
+ dry-inflector
6
+ dry-validation
7
+ hanami-helpers (~> 1.2)
8
+ hanami-model (~> 1.2)
9
+ i18n
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ ast (2.4.0)
15
+ concurrent-ruby (1.0.5)
16
+ diff-lcs (1.3)
17
+ dry-configurable (0.7.0)
18
+ concurrent-ruby (~> 1.0)
19
+ dry-container (0.6.0)
20
+ concurrent-ruby (~> 1.0)
21
+ dry-configurable (~> 0.1, >= 0.1.3)
22
+ dry-core (0.4.6)
23
+ concurrent-ruby (~> 1.0)
24
+ dry-equalizer (0.2.1)
25
+ dry-inflector (0.1.2)
26
+ dry-initializer (1.4.1)
27
+ dry-logic (0.4.2)
28
+ dry-container (~> 0.2, >= 0.2.6)
29
+ dry-core (~> 0.2)
30
+ dry-equalizer (~> 0.2)
31
+ dry-struct (0.3.1)
32
+ dry-configurable (~> 0.1)
33
+ dry-core (~> 0.3)
34
+ dry-equalizer (~> 0.2)
35
+ dry-types (~> 0.9, >= 0.9.0)
36
+ ice_nine (~> 0.11)
37
+ dry-types (0.11.1)
38
+ concurrent-ruby (~> 1.0)
39
+ dry-configurable (~> 0.1)
40
+ dry-container (~> 0.3)
41
+ dry-core (~> 0.2, >= 0.2.1)
42
+ dry-equalizer (~> 0.2)
43
+ dry-logic (~> 0.4, >= 0.4.0)
44
+ inflecto (~> 0.0.0, >= 0.0.2)
45
+ dry-validation (0.11.0)
46
+ concurrent-ruby (~> 1.0)
47
+ dry-configurable (~> 0.1, >= 0.1.3)
48
+ dry-core (~> 0.2, >= 0.2.1)
49
+ dry-equalizer (~> 0.2)
50
+ dry-logic (~> 0.4, >= 0.4.0)
51
+ dry-types (~> 0.11.0)
52
+ hanami-helpers (1.2.0)
53
+ hanami-utils (~> 1.2)
54
+ hanami-model (1.2.0)
55
+ concurrent-ruby (~> 1.0)
56
+ dry-types (~> 0.11.0)
57
+ hanami-utils (~> 1.2)
58
+ rom (~> 3.3, >= 3.3.3)
59
+ rom-repository (~> 1.4)
60
+ rom-sql (~> 1.3, >= 1.3.5)
61
+ hanami-utils (1.2.0)
62
+ concurrent-ruby (~> 1.0)
63
+ transproc (~> 1.0)
64
+ i18n (1.0.1)
65
+ concurrent-ruby (~> 1.0)
66
+ ice_nine (0.11.2)
67
+ inflecto (0.0.2)
68
+ parallel (1.12.1)
69
+ parser (2.5.0.5)
70
+ ast (~> 2.4.0)
71
+ powerpack (0.1.1)
72
+ rainbow (3.0.0)
73
+ rake (10.5.0)
74
+ rom (3.3.3)
75
+ concurrent-ruby (~> 1.0)
76
+ dry-core (~> 0.3)
77
+ dry-equalizer (~> 0.2)
78
+ dry-initializer (~> 1.3)
79
+ dry-types (~> 0.9, >= 0.9.4)
80
+ rom-mapper (~> 0.5, >= 0.5.1)
81
+ rom-mapper (0.5.1)
82
+ dry-core (~> 0.2, >= 0.2.3)
83
+ dry-equalizer (~> 0.2)
84
+ transproc (~> 1.0)
85
+ rom-repository (1.4.0)
86
+ dry-core (~> 0.3, >= 0.3.1)
87
+ dry-struct (~> 0.3)
88
+ rom (~> 3.3)
89
+ rom-mapper (~> 0.5)
90
+ rom-sql (1.3.5)
91
+ dry-core (~> 0.3)
92
+ dry-equalizer (~> 0.2)
93
+ dry-types (~> 0.11.0)
94
+ rom (~> 3.2, >= 3.2.2)
95
+ sequel (~> 4.43)
96
+ rspec (3.7.0)
97
+ rspec-core (~> 3.7.0)
98
+ rspec-expectations (~> 3.7.0)
99
+ rspec-mocks (~> 3.7.0)
100
+ rspec-core (3.7.1)
101
+ rspec-support (~> 3.7.0)
102
+ rspec-expectations (3.7.0)
103
+ diff-lcs (>= 1.2.0, < 2.0)
104
+ rspec-support (~> 3.7.0)
105
+ rspec-mocks (3.7.0)
106
+ diff-lcs (>= 1.2.0, < 2.0)
107
+ rspec-support (~> 3.7.0)
108
+ rspec-support (3.7.1)
109
+ rubocop (0.54.0)
110
+ parallel (~> 1.10)
111
+ parser (>= 2.5)
112
+ powerpack (~> 0.1)
113
+ rainbow (>= 2.2.2, < 4.0)
114
+ ruby-progressbar (~> 1.7)
115
+ unicode-display_width (~> 1.0, >= 1.0.1)
116
+ ruby-progressbar (1.9.0)
117
+ sequel (4.49.0)
118
+ transproc (1.0.2)
119
+ unicode-display_width (1.3.0)
120
+
121
+ PLATFORMS
122
+ ruby
123
+
124
+ DEPENDENCIES
125
+ bundler (~> 1.16)
126
+ hanami-i18n!
127
+ rake (~> 10.0)
128
+ rspec (~> 3.0)
129
+ rubocop
130
+
131
+ BUNDLED WITH
132
+ 1.16.1
data/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # Hanami::I18n
2
+
3
+ This gem provide i18n for hanami
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'hanami-i18n'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install hanami-i18n
20
+
21
+ ## Usage
22
+
23
+ ### Prepare locales file
24
+
25
+ In your hanami application, you should prepare locales file to `config/locale`.
26
+
27
+ ```yml
28
+ ja: # config/locale/ja.yml
29
+ model:
30
+ entities:
31
+ user: ユーザー
32
+ book: 本
33
+ attributes:
34
+ user:
35
+ name: 名前
36
+ email: メールアドレス
37
+ book:
38
+ title: タイトル
39
+ auther: 著者
40
+
41
+ ```
42
+
43
+ ### Initialize I18n
44
+
45
+ In your initializer, you should set available locales and load path.
46
+
47
+ ```ruby
48
+ # config/initializers/i18n.rb
49
+
50
+ I18n.available_locales = [:ja, :en]
51
+ I18n.default_locale = :ja
52
+ I18n.load_path += Dir[Hanami.root.join('config', 'locale', '*.{rb,yml}')]
53
+
54
+ ```
55
+
56
+ and you can use i18n in your application!
57
+
58
+ ## Form
59
+
60
+ In your view, if you defined yml file above, you can use translation in your form label.
61
+
62
+ ```rhtml
63
+ <%=
64
+ form_for :user routes.user_path do
65
+ label :name # => 名前
66
+ text_field :name
67
+
68
+ label :email # => メールアドレス
69
+ text_field :email
70
+ end
71
+ %>
72
+ ```
73
+
74
+ ## View
75
+
76
+ ```rhtml
77
+ <%= Book.t %> <% # => 本 %>
78
+ <%= Book.t(:title) %> <% # => タイトル %>
79
+ <%= Book.t(:auther) %> <% # => 著者 %>
80
+
81
+ ```
82
+
83
+ ## Development
84
+
85
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
86
+
87
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
88
+
89
+ ## Contributing
90
+
91
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hanami-i18n. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
92
+
93
+ ## Code of Conduct
94
+
95
+ Everyone interacting in the Hanami::I18n project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/hanami-i18n/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "hanami/i18n"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,44 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ lib = File.expand_path('lib', __dir__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require 'hanami/i18n/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'hanami-i18n'
10
+ spec.version = Hanami::I18n::VERSION
11
+ spec.authors = ['ippachi']
12
+ spec.email = ['ivalice1218@gmail.com']
13
+
14
+ spec.summary = 'i18n for hanami'
15
+ # spec.description = %q{TODO: Write a longer description or delete this line.}
16
+ spec.homepage = "https://github.com/ippachi/hanami-i18n"
17
+
18
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
20
+ if spec.respond_to?(:metadata)
21
+ spec.metadata['allowed_push_host'] = "https://rubygems.org/"
22
+ else
23
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
24
+ 'public gem pushes.'
25
+ end
26
+
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
28
+ f.match(%r{^(test|spec|features)/})
29
+ end
30
+ spec.bindir = 'exe'
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ['lib']
33
+
34
+ spec.add_dependency 'dry-validation'
35
+ spec.add_dependency 'dry-inflector'
36
+ spec.add_dependency 'hanami-helpers', '~> 1.2'
37
+ spec.add_dependency 'hanami-model', '~> 1.2'
38
+ spec.add_dependency 'i18n'
39
+
40
+ spec.add_development_dependency 'bundler', '~> 1.16'
41
+ spec.add_development_dependency 'rake', '~> 10.0'
42
+ spec.add_development_dependency 'rspec', '~> 3.0'
43
+ spec.add_development_dependency 'rubocop'
44
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'hanami/i18n/version'
4
+ require 'hanami/i18n/entity'
5
+ require 'hanami/i18n/helpers/form_helper/form_builder'
6
+ require 'hanami/i18n/view'
7
+
8
+ ::Hanami::View.configure do
9
+ prepare do
10
+ include Hanami::I18n::View
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'dry/validation/result'
4
+ require 'hanami/i18n/validation'
5
+
6
+ module Dry
7
+ module Validation
8
+ class Result
9
+ # prepend Hanami::I18n::Validation
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'i18n'
4
+ require 'dry/inflector'
5
+ require 'hanami/model'
6
+
7
+ module Hanami
8
+ class Entity
9
+ # Translate entity name and attribute names.
10
+ #
11
+ # @param attribute [Symbol] attribute name you want translate.
12
+ #
13
+ # @return [String] translated entity name or attribute name.
14
+ #
15
+ # @example
16
+ #
17
+ # # en:
18
+ # # model:
19
+ # # entities:
20
+ # # user: 'User'
21
+ # # attributes:
22
+ # # user:
23
+ # # name: 'Name'
24
+ #
25
+ # User.t # => 'User'
26
+ # User.t(:name) # => 'Name'
27
+ #
28
+ def self.t(attribute = nil)
29
+ inflector = Dry::Inflector.new
30
+ entity_name = inflector.singularize(inflector.tableize(name))
31
+
32
+ if attribute
33
+ ::I18n.t(attribute,
34
+ scope: "model.attributes.#{entity_name}")
35
+ else
36
+ ::I18n.t(entity_name,
37
+ scope: 'model.entities')
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hanami::I18n
4
+ module Form
5
+ # Translate form label
6
+ #
7
+ # override Hanami::Helpers::FormHelper::FormBuilder#label
8
+ def label(content, attributes = {})
9
+ content = I18n.t(content,
10
+ scope: "model.attributes.#{@name}",
11
+ default: Hanami::Utils::String.capitalize(content))
12
+ super(content, attributes)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'hanami/helpers/form_helper/form_builder'
4
+ require 'hanami/i18n/form.rb'
5
+
6
+ module Hanami
7
+ module Helpers
8
+ module FormHelper
9
+ class FormBuilder
10
+ prepend Hanami::I18n::Form
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'i18n'
4
+
5
+ module Hanami::I18n
6
+ module Validation
7
+ def errors(options = {}.freeze)
8
+ h = super(options)
9
+ h.each_with_object({}) do |(k1, v1), hash1|
10
+ hash1[k1] = v1.each_with_object({}) do |(k2, v2), hash2|
11
+ hash2[I18n.t(k2,
12
+ scope: "model.attributes.#{k1}",
13
+ default: Hanami::Utils::String.capitalize(k2))] = v2[0]
14
+ end
15
+ end
16
+ end
17
+
18
+ def messages(options = {}.freeze)
19
+ h = super(options)
20
+ h.each_with_object({}) do |(k1, v1), hash1|
21
+ hash1[k1] = v1.each_with_object({}) do |(k2, v2), hash2|
22
+ hash2[I18n.t(k2,
23
+ scope: "model.attributes.#{k1}",
24
+ default: Hanami::Utils::String.capitalize(k2))] = v2[0]
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hanami
4
+ module I18n
5
+ VERSION = '0.1.1'
6
+ end
7
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hanami::I18n
4
+ module View
5
+ # Translate specific word
6
+ #
7
+ # @param object_str [String] i18n string you want translate
8
+ # @param options [Hash] i18n options
9
+ #
10
+ # @return [String] translated word
11
+ #
12
+ # @example
13
+ # # apps/web/templates/users/index.html.erb
14
+ # # en:
15
+ # # users:
16
+ # # index:
17
+ # # title: hello
18
+ #
19
+ # <%= t('.title') %> # => 'hello'
20
+ # <%= t('users.index.title') %> # => 'hello'
21
+ #
22
+ def t(object_str, options = {})
23
+ if object_str[0] == '.'
24
+ file_path = template.instance_variable_get(:@_template).file
25
+
26
+ dir_structure = file_path.gsub(/\.html\..*/, '').split('/')
27
+
28
+ index = dir_structure.index('templates')
29
+ translation_path = dir_structure[index + 1..-1].join('.')
30
+ options[:scope] = translation_path
31
+ end
32
+
33
+ I18n.t(object_str, options)
34
+ end
35
+ end
36
+ end
data/locale/ja.yml ADDED
@@ -0,0 +1,89 @@
1
+ ja:
2
+ errors:
3
+ or: "or"
4
+ array?: "は配列にしてください"
5
+
6
+ empty?: "は空にしてください"
7
+
8
+ excludes?: "は%{value}を含まないでください"
9
+
10
+ excluded_from?:
11
+ arg:
12
+ default: "must not be one of: %{list}"
13
+ range: "must not be one of: %{list_left} - %{list_right}"
14
+ exclusion?: "must not be one of: %{list}"
15
+
16
+ eql?: "は%{left}と等しい値にしてください"
17
+
18
+ not_eql?: "は%{left}と異なる値にしてください"
19
+
20
+ filled?: "を入力してください"
21
+
22
+ format?: "は不正な形式です"
23
+
24
+ number?: "は数値にしてください"
25
+
26
+ odd?: "は奇数にしてください"
27
+
28
+ even?: "は偶数にしてください"
29
+
30
+ gt?: "は%{num}より大きい値にしてください"
31
+
32
+ gteq?: "は%{num}以上の値にしてください"
33
+
34
+ hash?: "はHashにしてください"
35
+
36
+ included_in?:
37
+ arg:
38
+ default: "must be one of: %{list}"
39
+ range: "must be one of: %{list_left} - %{list_right}"
40
+ inclusion?: "must be one of: %{list}"
41
+
42
+ includes?: "は%{value}を含んでください"
43
+
44
+ bool?: "は真偽値にしてください"
45
+
46
+ true?: "はtrueにしてください"
47
+
48
+ false?: "はfalseにしてください"
49
+
50
+ int?: "は整数にしてください"
51
+
52
+ float?: "は少数にしてください"
53
+
54
+ decimal?: "は少数にしてください"
55
+
56
+ date?: "は日付にしてください"
57
+
58
+ date_time?: "は日時にしてください"
59
+
60
+ time?: "は時間にしてください"
61
+
62
+ key?: "を入力してください"
63
+
64
+ attr?: "を入力してください"
65
+
66
+ lt?: "は%{num}より小さい値にしてください"
67
+
68
+ lteq?: "は%{num}以下の値にしてください"
69
+
70
+ max_size?: "は%{num}以下のサイズにしてください"
71
+
72
+ min_size?: "は%{num}以上のサイズにしてください"
73
+
74
+ none?: "は定義できません"
75
+
76
+ str?: "は文字列を入力してください"
77
+
78
+ type?: "は%{type}を入力してください"
79
+
80
+ size?:
81
+ arg:
82
+ default: "size must be %{size}"
83
+ range: "size must be within %{size_left} - %{size_right}"
84
+
85
+ value:
86
+ string:
87
+ arg:
88
+ default: "length must be %{size}"
89
+ range: "length must be within %{size_left} - %{size_right}"
metadata ADDED
@@ -0,0 +1,192 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hanami-i18n
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - ippachi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-05-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dry-validation
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dry-inflector
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hanami-helpers
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: hanami-model
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: i18n
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.16'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.16'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '10.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '10.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description:
140
+ email:
141
+ - ivalice1218@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - ".rspec"
148
+ - ".rubocop.yml"
149
+ - ".rubocop_todo.yml"
150
+ - ".travis.yml"
151
+ - CODE_OF_CONDUCT.md
152
+ - Gemfile
153
+ - Gemfile.lock
154
+ - README.md
155
+ - Rakefile
156
+ - bin/console
157
+ - bin/setup
158
+ - hanami-i18n.gemspec
159
+ - lib/hanami/i18n.rb
160
+ - lib/hanami/i18n/dry/validation/result.rb
161
+ - lib/hanami/i18n/entity.rb
162
+ - lib/hanami/i18n/form.rb
163
+ - lib/hanami/i18n/helpers/form_helper/form_builder.rb
164
+ - lib/hanami/i18n/validation.rb
165
+ - lib/hanami/i18n/version.rb
166
+ - lib/hanami/i18n/view.rb
167
+ - locale/ja.yml
168
+ homepage: https://github.com/ippachi/hanami-i18n
169
+ licenses: []
170
+ metadata:
171
+ allowed_push_host: https://rubygems.org/
172
+ post_install_message:
173
+ rdoc_options: []
174
+ require_paths:
175
+ - lib
176
+ required_ruby_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ required_rubygems_version: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ requirements: []
187
+ rubyforge_project:
188
+ rubygems_version: 2.7.6
189
+ signing_key:
190
+ specification_version: 4
191
+ summary: i18n for hanami
192
+ test_files: []