habluhablu 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +18 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +29 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +55 -0
- data/LICENSE.txt +21 -0
- data/README.md +47 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/habluhablu +26 -0
- data/bin/setup +8 -0
- data/habluhablu.gemspec +37 -0
- data/languages/Countries_Flags.md +13 -0
- data/languages/ar.yml +2 -0
- data/languages/en.yml +2 -0
- data/languages/es.yml +2 -0
- data/languages/iw.yml +2 -0
- data/languages/pl.yml +2 -0
- data/lib/habluhablu.rb +43 -0
- data/lib/habluhablu/version.rb +5 -0
- metadata +70 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e59482360e21f3a8dca5d1114a494e5dd4dd10ddb603c9b1acc010bef8724670
|
|
4
|
+
data.tar.gz: c76b0010dc85ffffbc79f59738851af2bc050236abc40a2754a3841af2ba83ef
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: aad0edcb6f8b3986f7ef76533d317020ac6693cb013d1cddec208d2839f647dd19e8951f4bf45ca67623157099c3f2e3f215012729651f5fd90e113d9d46f4df
|
|
7
|
+
data.tar.gz: c285834be77e75ac8490da796080bd5699899d9f45cc90a5352463f5e61afb957c356dcad0d44f7d3ecaba577e25b2016dca4cead31f9ff9962a9037c6ed9589
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Ruby
|
|
2
|
+
|
|
3
|
+
on: [push,pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v2
|
|
10
|
+
- name: Set up Ruby
|
|
11
|
+
uses: ruby/setup-ruby@v1
|
|
12
|
+
with:
|
|
13
|
+
ruby-version: 2.7.2
|
|
14
|
+
- name: Run the default task
|
|
15
|
+
run: |
|
|
16
|
+
gem install bundler -v 2.2.14
|
|
17
|
+
bundle install
|
|
18
|
+
bundle exec rake
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 2.7
|
|
3
|
+
Exclude:
|
|
4
|
+
- 'spec/**/*'
|
|
5
|
+
|
|
6
|
+
Layout/EndOfLine:
|
|
7
|
+
Enabled: false
|
|
8
|
+
|
|
9
|
+
Style/StringLiterals:
|
|
10
|
+
Enabled: true
|
|
11
|
+
EnforcedStyle: double_quotes
|
|
12
|
+
|
|
13
|
+
Style/StringLiteralsInInterpolation:
|
|
14
|
+
Enabled: true
|
|
15
|
+
EnforcedStyle: double_quotes
|
|
16
|
+
|
|
17
|
+
Layout/LineLength:
|
|
18
|
+
Max: 120
|
|
19
|
+
|
|
20
|
+
Metrics/MethodLength:
|
|
21
|
+
Max: 11
|
|
22
|
+
|
|
23
|
+
Style/IfUnlessModifier:
|
|
24
|
+
Exclude:
|
|
25
|
+
- 'lib/**/*'
|
|
26
|
+
|
|
27
|
+
Style/RaiseArgs:
|
|
28
|
+
Exclude:
|
|
29
|
+
- 'lib/habluhablu.rb'
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
habluhablu (0.1.4)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
ast (2.4.2)
|
|
10
|
+
diff-lcs (1.4.4)
|
|
11
|
+
parallel (1.20.1)
|
|
12
|
+
parser (3.0.1.1)
|
|
13
|
+
ast (~> 2.4.1)
|
|
14
|
+
rainbow (3.0.0)
|
|
15
|
+
rake (13.0.3)
|
|
16
|
+
regexp_parser (2.1.1)
|
|
17
|
+
rexml (3.2.5)
|
|
18
|
+
rspec (3.10.0)
|
|
19
|
+
rspec-core (~> 3.10.0)
|
|
20
|
+
rspec-expectations (~> 3.10.0)
|
|
21
|
+
rspec-mocks (~> 3.10.0)
|
|
22
|
+
rspec-core (3.10.1)
|
|
23
|
+
rspec-support (~> 3.10.0)
|
|
24
|
+
rspec-expectations (3.10.1)
|
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
26
|
+
rspec-support (~> 3.10.0)
|
|
27
|
+
rspec-mocks (3.10.2)
|
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
+
rspec-support (~> 3.10.0)
|
|
30
|
+
rspec-support (3.10.2)
|
|
31
|
+
rubocop (1.14.0)
|
|
32
|
+
parallel (~> 1.10)
|
|
33
|
+
parser (>= 3.0.0.0)
|
|
34
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
35
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
36
|
+
rexml
|
|
37
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
|
38
|
+
ruby-progressbar (~> 1.7)
|
|
39
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
40
|
+
rubocop-ast (1.5.0)
|
|
41
|
+
parser (>= 3.0.1.1)
|
|
42
|
+
ruby-progressbar (1.11.0)
|
|
43
|
+
unicode-display_width (2.0.0)
|
|
44
|
+
|
|
45
|
+
PLATFORMS
|
|
46
|
+
x64-mingw32
|
|
47
|
+
|
|
48
|
+
DEPENDENCIES
|
|
49
|
+
habluhablu!
|
|
50
|
+
rake (~> 13.0)
|
|
51
|
+
rspec (~> 3.0)
|
|
52
|
+
rubocop (~> 1.7)
|
|
53
|
+
|
|
54
|
+
BUNDLED WITH
|
|
55
|
+
2.2.14
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Patrick Gramatowski
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# HabluHablu
|
|
2
|
+
|
|
3
|
+
HabluHablu is a gem which allows you to generate language file with translations of the most useful phrases.
|
|
4
|
+
|
|
5
|
+
There is also an option to add countries flag using bootstrap (for more informations go to languages/Countries_Flags.md).
|
|
6
|
+
|
|
7
|
+
## Supported languages
|
|
8
|
+
|
|
9
|
+
- English
|
|
10
|
+
- Polish
|
|
11
|
+
- Spanish
|
|
12
|
+
- German
|
|
13
|
+
- French
|
|
14
|
+
- Hebrew
|
|
15
|
+
- If you want to help me out and add your language, then contact me patrick.gramatowski@gmail.com
|
|
16
|
+
- In progress...
|
|
17
|
+
|
|
18
|
+
### Installation
|
|
19
|
+
|
|
20
|
+
Add this line to your application's Gemfile:
|
|
21
|
+
|
|
22
|
+
Install [I18n gem](https://github.com/ruby-i18n/i18n)
|
|
23
|
+
|
|
24
|
+
```ruby
|
|
25
|
+
gem 'habluhablu'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
And then execute:
|
|
29
|
+
|
|
30
|
+
$ bundle install
|
|
31
|
+
|
|
32
|
+
Or install it yourself as:
|
|
33
|
+
|
|
34
|
+
$ gem install habluhablu
|
|
35
|
+
|
|
36
|
+
### Usage
|
|
37
|
+
|
|
38
|
+
Generate file for a specific language using `habluhablu language <symbol>` command.
|
|
39
|
+
[List of symbols](https://www.w3.org/International/O-charset-lang.html)
|
|
40
|
+
|
|
41
|
+
### Contributing
|
|
42
|
+
|
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/patrickgramatowski/habluhablu_gem.
|
|
44
|
+
|
|
45
|
+
### License
|
|
46
|
+
|
|
47
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "bundler/setup"
|
|
5
|
+
require "habluhablu"
|
|
6
|
+
|
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
+
|
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
11
|
+
# require "pry"
|
|
12
|
+
# Pry.start
|
|
13
|
+
|
|
14
|
+
require "irb"
|
|
15
|
+
IRB.start(__FILE__)
|
data/bin/habluhablu
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "thor"
|
|
5
|
+
require "habluhablu"
|
|
6
|
+
|
|
7
|
+
# Class comment
|
|
8
|
+
class CLI < Thor
|
|
9
|
+
desc "help", "some"
|
|
10
|
+
desc "<language>", "Generate file .yml"
|
|
11
|
+
long_desc <<-LONGDESC
|
|
12
|
+
Generate files including basic phrases translations (using with I18n gem).
|
|
13
|
+
LONGDESC
|
|
14
|
+
def language(symbol)
|
|
15
|
+
Habluhablu.hablu(symbol)
|
|
16
|
+
if File.exist?("config/locales/#{symbol}.yml")
|
|
17
|
+
puts "..."
|
|
18
|
+
sleep 0.5
|
|
19
|
+
puts "File for #{symbol.upcase} language has been generated successfully!"
|
|
20
|
+
else
|
|
21
|
+
puts "Something went wrong!"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
CLI.start(ARGV)
|
data/bin/setup
ADDED
data/habluhablu.gemspec
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/habluhablu/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "habluhablu"
|
|
7
|
+
spec.version = Habluhablu::VERSION
|
|
8
|
+
spec.authors = ["Patrick Gramatowski"]
|
|
9
|
+
spec.email = ["patrick.gramatowski@gmail.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "HabluHablu makes it easier to use I18n."
|
|
12
|
+
spec.description = "The gem allows you to generate language file with translations of the most useful phrases."
|
|
13
|
+
spec.homepage = "https://github.com/patrickgramatowski/habluhablu"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
|
16
|
+
|
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
18
|
+
|
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
20
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
21
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/CHANGELOG.md"
|
|
22
|
+
|
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
|
27
|
+
end
|
|
28
|
+
spec.bindir = "exe"
|
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
31
|
+
|
|
32
|
+
# Uncomment to register a new dependency of your gem
|
|
33
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
|
34
|
+
|
|
35
|
+
# For more information and examples about making a new gem, checkout our
|
|
36
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
|
37
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# You can also add countries flags
|
|
2
|
+
|
|
3
|
+
## Using bootstrap
|
|
4
|
+
[Documentation](https://mdbootstrap.com/docs/standard/content-styles/flags/)
|
|
5
|
+
Example:
|
|
6
|
+
```html
|
|
7
|
+
<i class="flag flag-us"></i>
|
|
8
|
+
<i class="flag flag-united-kingdom"></i>
|
|
9
|
+
<i class="flag flag-egypt"></i>
|
|
10
|
+
<i class="flag flag-poland"></i>
|
|
11
|
+
<i class="flag flag-spain"></i>
|
|
12
|
+
<i class="flag flag-israel"></i>
|
|
13
|
+
```
|
data/languages/ar.yml
ADDED
data/languages/en.yml
ADDED
data/languages/es.yml
ADDED
data/languages/iw.yml
ADDED
data/languages/pl.yml
ADDED
data/lib/habluhablu.rb
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "habluhablu/version"
|
|
4
|
+
|
|
5
|
+
# Module HabluHablu
|
|
6
|
+
module Habluhablu
|
|
7
|
+
class Error < StandardError; end
|
|
8
|
+
|
|
9
|
+
# Cutom error with helpful message
|
|
10
|
+
class WrongSymbolError < Error
|
|
11
|
+
def initialize(language)
|
|
12
|
+
super("Wrong language symbol: #{language}!")
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Cutom error with helpful message
|
|
17
|
+
class GemI18nError < Error
|
|
18
|
+
def initialize
|
|
19
|
+
super("Install I18n gem!")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.hablu(language)
|
|
24
|
+
# Check if I18n gem is included
|
|
25
|
+
# if not, raise the custom error
|
|
26
|
+
if Dir.exist?("./config/locales").eql?(false)
|
|
27
|
+
raise GemI18nError.new
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Check if specified symbol's language does exist
|
|
31
|
+
# if not, raise the custom error
|
|
32
|
+
if File.exist?("./languages/#{language}.yml").eql?(false)
|
|
33
|
+
raise WrongSymbolError.new(language)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Create a file of specified language
|
|
37
|
+
File.open("./config/locales/#{language}.yml", "w") do |f|
|
|
38
|
+
File.open("./languages/#{language}.yml") do |i18n|
|
|
39
|
+
f.write(i18n.read.to_s)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: habluhablu
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.4
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Patrick Gramatowski
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2021-05-06 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: The gem allows you to generate language file with translations of the
|
|
14
|
+
most useful phrases.
|
|
15
|
+
email:
|
|
16
|
+
- patrick.gramatowski@gmail.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- ".github/workflows/main.yml"
|
|
22
|
+
- ".gitignore"
|
|
23
|
+
- ".rspec"
|
|
24
|
+
- ".rubocop.yml"
|
|
25
|
+
- CHANGELOG.md
|
|
26
|
+
- Gemfile
|
|
27
|
+
- Gemfile.lock
|
|
28
|
+
- LICENSE.txt
|
|
29
|
+
- README.md
|
|
30
|
+
- Rakefile
|
|
31
|
+
- bin/console
|
|
32
|
+
- bin/habluhablu
|
|
33
|
+
- bin/setup
|
|
34
|
+
- habluhablu.gemspec
|
|
35
|
+
- languages/Countries_Flags.md
|
|
36
|
+
- languages/ar.yml
|
|
37
|
+
- languages/en.yml
|
|
38
|
+
- languages/es.yml
|
|
39
|
+
- languages/iw.yml
|
|
40
|
+
- languages/pl.yml
|
|
41
|
+
- lib/habluhablu.rb
|
|
42
|
+
- lib/habluhablu/version.rb
|
|
43
|
+
homepage: https://github.com/patrickgramatowski/habluhablu
|
|
44
|
+
licenses:
|
|
45
|
+
- MIT
|
|
46
|
+
metadata:
|
|
47
|
+
allowed_push_host: https://rubygems.org
|
|
48
|
+
homepage_uri: https://github.com/patrickgramatowski/habluhablu
|
|
49
|
+
source_code_uri: https://github.com/patrickgramatowski/habluhablu
|
|
50
|
+
changelog_uri: https://github.com/patrickgramatowski/habluhablu/CHANGELOG.md
|
|
51
|
+
post_install_message:
|
|
52
|
+
rdoc_options: []
|
|
53
|
+
require_paths:
|
|
54
|
+
- lib
|
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
|
+
requirements:
|
|
57
|
+
- - ">="
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: 2.7.0
|
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
|
+
requirements:
|
|
62
|
+
- - ">="
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
version: '0'
|
|
65
|
+
requirements: []
|
|
66
|
+
rubygems_version: 3.2.14
|
|
67
|
+
signing_key:
|
|
68
|
+
specification_version: 4
|
|
69
|
+
summary: HabluHablu makes it easier to use I18n.
|
|
70
|
+
test_files: []
|