habluhablu 0.1.8 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +49 -29
- data/Gemfile.lock +1 -1
- data/README.md +50 -49
- data/exe/habluhablu +22 -7
- data/habluhablu.gemspec +1 -1
- data/lib/habluhablu.rb +5 -1
- data/lib/habluhablu/version.rb +1 -1
- data/lib/languages/languages.rb +121 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 176362e18a8aa159746f31972df293f854a9b596cf67404ecf26669d0cb2e458
|
4
|
+
data.tar.gz: b519b6b00ba63a4e4bc345e0f865c6116825ac87eb4b29da920a8d63018025b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 665658210f5d615d9dd2d83efc9685b548a290de796842ec627b0ff6a4a0859604c2d99a5b39e20bb905003522dd59c402aca1f0ec800e353478172c1677c809
|
7
|
+
data.tar.gz: 03bd56cfd7945c44704dbd1df2107a9158391cfd13529415942f6525bdad4faec03b92e6c6e6571986bf345d18a10e704564f3797b2b47e57a7268690e91a0d3
|
data/.rubocop.yml
CHANGED
@@ -1,29 +1,49 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 2.7
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Style/
|
28
|
-
Exclude:
|
29
|
-
- 'lib
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.7
|
3
|
+
SuggestExtensions: false
|
4
|
+
NewCops: enable
|
5
|
+
Exclude:
|
6
|
+
- 'spec/**/*'
|
7
|
+
|
8
|
+
Layout/EndOfLine:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Style/StringLiterals:
|
12
|
+
Enabled: true
|
13
|
+
EnforcedStyle: double_quotes
|
14
|
+
|
15
|
+
Style/StringLiteralsInInterpolation:
|
16
|
+
Enabled: true
|
17
|
+
EnforcedStyle: double_quotes
|
18
|
+
|
19
|
+
Layout/LineLength:
|
20
|
+
Max: 120
|
21
|
+
|
22
|
+
Metrics/MethodLength:
|
23
|
+
Exclude:
|
24
|
+
- 'lib/languages/languages.rb'
|
25
|
+
Max: 20
|
26
|
+
|
27
|
+
Style/IfUnlessModifier:
|
28
|
+
Exclude:
|
29
|
+
- 'lib/**/*'
|
30
|
+
|
31
|
+
Style/RaiseArgs:
|
32
|
+
Exclude:
|
33
|
+
- 'lib/habluhablu.rb'
|
34
|
+
|
35
|
+
Style/IfWithBooleanLiteralBranches:
|
36
|
+
Exclude:
|
37
|
+
- 'lib/languages/languages.rb'
|
38
|
+
|
39
|
+
Lint/ScriptPermission:
|
40
|
+
Exclude:
|
41
|
+
- 'bin/console'
|
42
|
+
|
43
|
+
Metrics/ClassLength:
|
44
|
+
Exclude:
|
45
|
+
- 'lib/languages/languages.rb'
|
46
|
+
|
47
|
+
Style/OptionalBooleanParameter:
|
48
|
+
Exclude:
|
49
|
+
- 'lib/languages/languages.rb'
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,49 +1,50 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
HabluHablu
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
## Supported languages
|
8
|
-
|
9
|
-
- English
|
10
|
-
- Polish
|
11
|
-
-
|
12
|
-
-
|
13
|
-
-
|
14
|
-
-
|
15
|
-
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/habluhablu.svg)](https://badge.fury.io/rb/habluhablu)
|
2
|
+
|
3
|
+
# HabluHablu
|
4
|
+
|
5
|
+
HabluHablu is a CLI written in Ruby, which allows you to generate language file with translations of the most useful phrases.
|
6
|
+
|
7
|
+
## Supported languages
|
8
|
+
|
9
|
+
- English
|
10
|
+
- Polish
|
11
|
+
- Arabic
|
12
|
+
- Spanish
|
13
|
+
- Hebrew
|
14
|
+
- If you want to help me out and add your language, don't hesitate!
|
15
|
+
- In progress...
|
16
|
+
|
17
|
+
### Installation
|
18
|
+
|
19
|
+
Add this line to your application's Gemfile:
|
20
|
+
|
21
|
+
Install [I18n gem](https://github.com/ruby-i18n/i18n)
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'habluhablu'
|
25
|
+
```
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
$ bundle install
|
30
|
+
|
31
|
+
Or install it yourself as:
|
32
|
+
|
33
|
+
$ gem install habluhablu
|
34
|
+
|
35
|
+
### Usage
|
36
|
+
|
37
|
+
Generate file for a specific language using `habluhablu -l <symbol>` command.
|
38
|
+
[List of symbols](https://www.w3.org/International/O-charset-lang.html)
|
39
|
+
|
40
|
+
`habluhablu --help`
|
41
|
+
|
42
|
+
There is also an option to add countries flag using bootstrap (for more informations go to languages/Countries_Flags.md).
|
43
|
+
|
44
|
+
### Contributing
|
45
|
+
|
46
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/patrickgramatowski/habluhablu_gem.
|
47
|
+
|
48
|
+
### License
|
49
|
+
|
50
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/exe/habluhablu
CHANGED
@@ -8,14 +8,29 @@ args = {}
|
|
8
8
|
OptionParser.new do |opts|
|
9
9
|
opts.banner = "Generate files including basic phrases translations (using with I18n gem)"
|
10
10
|
|
11
|
-
opts.on("-l", "--language SYMBOL", "
|
11
|
+
opts.on("-l", "--language SYMBOL", "Symbol of the language you want to generate file for (en, es, ...).")
|
12
|
+
opts.on("-m", "--multi SYMBOLS", "Symbols of languages you want to generate files for (en es pl ar)")
|
12
13
|
end.parse!(into: args)
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
if args[:multi].nil?
|
16
|
+
Habluhablu.hablu(args[:language])
|
17
|
+
if File.exist?("config/locales/#{args[:language]}.yml")
|
18
|
+
puts "..."
|
19
|
+
sleep 0.5
|
20
|
+
puts "Everything was generated successfully!"
|
21
|
+
else
|
22
|
+
puts "Something went wrong!"
|
23
|
+
end
|
19
24
|
else
|
20
|
-
|
25
|
+
languages_array = args[:multi].split("_")
|
26
|
+
languages_array.each do |language|
|
27
|
+
Habluhablu.hablu(language)
|
28
|
+
end
|
29
|
+
if File.exist?("config/locales/#{languages_array.last}.yml")
|
30
|
+
puts "..."
|
31
|
+
sleep 0.5
|
32
|
+
puts "Everything was generated successfully!"
|
33
|
+
else
|
34
|
+
puts "Something went wrong!"
|
35
|
+
end
|
21
36
|
end
|
data/habluhablu.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["patrick.gramatowski@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = "HabluHablu makes it easier to use I18n."
|
12
|
-
spec.description = "
|
12
|
+
spec.description = "Generate language file (for I18n) with translations of the most useful phrases."
|
13
13
|
spec.homepage = "https://github.com/patrickgramatowski/habluhablu_gem"
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
data/lib/habluhablu.rb
CHANGED
@@ -21,7 +21,7 @@ module Habluhablu
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def self.hablu(language)
|
24
|
+
def self.hablu(language, lorem = false)
|
25
25
|
# Check if I18n gem is included
|
26
26
|
# if not, raise the custom error
|
27
27
|
if Dir.exist?("./config/locales").eql?(false)
|
@@ -35,6 +35,10 @@ module Habluhablu
|
|
35
35
|
raise WrongSymbolError.new(language)
|
36
36
|
end
|
37
37
|
|
38
|
+
if lorem.eql?(true)
|
39
|
+
language_class.include_lorem(lorem)
|
40
|
+
end
|
41
|
+
|
38
42
|
# Create a file of specified language
|
39
43
|
File.open("./config/locales/#{language}.yml", "w") do |f|
|
40
44
|
f.write(language_class.render)
|
data/lib/habluhablu/version.rb
CHANGED
data/lib/languages/languages.rb
CHANGED
@@ -8,19 +8,134 @@ class Languages
|
|
8
8
|
@language = language.to_sym
|
9
9
|
@languages = {
|
10
10
|
ar: {
|
11
|
-
ar
|
11
|
+
"ar" => {
|
12
|
+
"welcome" => "مرحبا",
|
13
|
+
"registration" => "عنوان البريد الإلكتروني",
|
14
|
+
"log_in" => "تسجيل الدخول",
|
15
|
+
"log_in_with" => "سجّل الدخول باستخدام حساب", # Example: 'with Facebook'
|
16
|
+
"log_out" => "تسجيل الخروج",
|
17
|
+
"email_address" => "عنوان البريد الإلكتروني",
|
18
|
+
"username" => "اسم االمستخدم",
|
19
|
+
"password" => "كلمه المرور",
|
20
|
+
"remember_me" => "تذكرنى",
|
21
|
+
"forgot_password" => "نسيت كلمة مرورك",
|
22
|
+
"do_not_have_account" => "ليس لديك حساب؟",
|
23
|
+
"lorem" => "غينيا واستمر العصبة ضرب قد. وباءت الأمريكي الأوربيين هو به،, هو العالم، الثقيلة بال. مع وايرلندا الأوروبيّون كان, قد بحق أسابيع العظمى واعتلاء. انه كل وإقامة المواد. "
|
24
|
+
}
|
12
25
|
},
|
13
26
|
en: {
|
14
|
-
en
|
27
|
+
"en" => {
|
28
|
+
"welcome" => "Welcome",
|
29
|
+
"registration" => "Registartion",
|
30
|
+
"log_in" => "Log in",
|
31
|
+
"log_in_with" => "Log in with", # Example: 'with Facebook'
|
32
|
+
"log_out" => "Log out",
|
33
|
+
"email_address" => "Email address",
|
34
|
+
"username" => "Username",
|
35
|
+
"password" => "Password",
|
36
|
+
"remember_me" => "Remember me",
|
37
|
+
"forgot_password" => "Forgot password?",
|
38
|
+
"do_not_have_account" => "Don't You have an account?",
|
39
|
+
"lorem" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
40
|
+
}
|
15
41
|
},
|
16
42
|
es: {
|
17
|
-
es
|
43
|
+
"es" => {
|
44
|
+
"welcome" => "Bienvenido",
|
45
|
+
"registration" => "Regístrate",
|
46
|
+
"log_in" => "Iniciar sesión",
|
47
|
+
"log_in_with" => "Iniciar sesión con", # Example: 'with Facebook'
|
48
|
+
"log_out" => "Cerrar la sesión",
|
49
|
+
"email_address" => "Dirección de correo electrónico",
|
50
|
+
"username" => "Nombre de usuario",
|
51
|
+
"password" => "Contraseña",
|
52
|
+
"remember_me" => "Recordarme",
|
53
|
+
"forgot_password" => "¿Has olvidado tu contraseña?",
|
54
|
+
"do_not_have_account" => "¿No tienes una cuenta?",
|
55
|
+
"lorem" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
56
|
+
}
|
18
57
|
},
|
19
58
|
pl: {
|
20
|
-
pl
|
59
|
+
"pl" => {
|
60
|
+
"welcome" => "Witaj",
|
61
|
+
"registration" => "Zarejestruj się",
|
62
|
+
"log_in" => "Zaloguj się",
|
63
|
+
"log_in_with" => "Zaloguj się za pomocą", # Example: 'with Facebook'
|
64
|
+
"log_out" => "Wyolguj się",
|
65
|
+
"email_address" => "Adres email",
|
66
|
+
"username" => "Nazwa użytkownika",
|
67
|
+
"password" => "Hasło",
|
68
|
+
"remember_me" => "Zapamiętaj mnie!",
|
69
|
+
"forgot_password" => "Zapomniałeś hasła?",
|
70
|
+
"do_not_have_account" => "Nie masz jeszcze konta?",
|
71
|
+
"lorem" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
72
|
+
}
|
21
73
|
},
|
22
74
|
iw: {
|
23
|
-
iw
|
75
|
+
"iw" => {
|
76
|
+
# I'm not sure about this translation, it has to be checked!!
|
77
|
+
"welcome" => "שלום",
|
78
|
+
"registration" => "הירשם",
|
79
|
+
"log_in" => "להתחבר",
|
80
|
+
"log_in_with" => "התחבר ל", # Example: 'with Facebook'
|
81
|
+
"log_out" => "להתנתק",
|
82
|
+
"email_address" => "אימייל",
|
83
|
+
"username" => "שם משתמש",
|
84
|
+
"password" => "סיסמה",
|
85
|
+
"remember_me" => "זכור אותי",
|
86
|
+
"forgot_password" => "שכחת את הסיסמא?",
|
87
|
+
"do_not_have_account" => "אין לך חשבון?",
|
88
|
+
"lorem" => "כדי יסוד מונחים מועמדים של, דת דפים מאמרשיחהצפה זאת. אתה דת שונה כלשהו, גם אחר ליום בשפות, או ניווט פולנית לחיבור ארץ. ויש בקלות ואמנות אירועים או, אל אינו כלכלה שתי."
|
89
|
+
}
|
90
|
+
},
|
91
|
+
fr: {
|
92
|
+
"fr" => {
|
93
|
+
"welcome" => "Bienvenu", # bienvenue female
|
94
|
+
"registration" => "Créer un compte",
|
95
|
+
"log_in" => "Connexion",
|
96
|
+
"log_in_with" => "Se connecter avec", # Example: 'with Facebook'
|
97
|
+
"log_out" => "Déconnexion",
|
98
|
+
"email_address" => "Adresse e-mail",
|
99
|
+
"username" => "Nom d'utilisateur",
|
100
|
+
"password" => "Mot de passe",
|
101
|
+
"remember_me" => "Mémoriser",
|
102
|
+
"forgot_password" => "Mot de passe oublié",
|
103
|
+
"do_not_have_account" => "Vous n'avez pas de compte?",
|
104
|
+
"lorem" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
105
|
+
}
|
106
|
+
},
|
107
|
+
it: {
|
108
|
+
"it" => {
|
109
|
+
"welcome" => "Benvenuto", # benvenuta female
|
110
|
+
"registration" => "Iscriviti",
|
111
|
+
"log_in" => "Accedi",
|
112
|
+
"log_in_with" => "Accedi con", # Example: 'with Facebook'
|
113
|
+
"log_out" => "Esci",
|
114
|
+
"email_address" => "Indirizzo e-mail",
|
115
|
+
"username" => "Nome utente",
|
116
|
+
"password" => "Password",
|
117
|
+
"remember_me" => "Ricordami",
|
118
|
+
"forgot_password" => "Ho dimenticato la password",
|
119
|
+
"do_not_have_account" => "Non possiedi un account?",
|
120
|
+
"lorem" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
121
|
+
}
|
122
|
+
},
|
123
|
+
de: {
|
124
|
+
"de" => {
|
125
|
+
"welcome" => "Willkommen",
|
126
|
+
"registration" => "Registrieren",
|
127
|
+
"log_in" => "Anmelden",
|
128
|
+
"log_in_with" => "Anmeldung mit", # Example: 'with Facebook'
|
129
|
+
"log_out" => "Abmelden",
|
130
|
+
"email_address" => "E-Mail-Adresse",
|
131
|
+
"username" => "Nutzername",
|
132
|
+
"password" => "Passwort",
|
133
|
+
"remember_me" => "Merken",
|
134
|
+
"forgot_password" => "Passwort vergessen?",
|
135
|
+
"do_not_have_account" => "Hast du noch kein FACEBOOK-Konto?", # Change facebook!
|
136
|
+
"lorem" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
137
|
+
|
138
|
+
}
|
24
139
|
}
|
25
140
|
}
|
26
141
|
end
|
@@ -30,6 +145,6 @@ class Languages
|
|
30
145
|
end
|
31
146
|
|
32
147
|
def render
|
33
|
-
@languages.key?(@language) ? @languages[@language].to_yaml : "No language in the lib
|
148
|
+
@languages.key?(@language) ? @languages[@language].to_yaml : "No language in the lib (YET!)"
|
34
149
|
end
|
35
150
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: habluhablu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Gramatowski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
13
|
+
description: Generate language file (for I18n) with translations of the most useful
|
14
|
+
phrases.
|
15
15
|
email:
|
16
16
|
- patrick.gramatowski@gmail.com
|
17
17
|
executables:
|