habluhablu 0.1.6 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bba18ca9ad12e5201bf1c04bcddd0126c6f2460bd2dd26de70d14d8adf24ce30
4
- data.tar.gz: 7781750dd34afec7824b7843f92a5f706204fa843fb3dbee7621d43bbe030be7
3
+ metadata.gz: 1f072b8f411337c5c7fce24d5b46306ebfbc42f9c11e370020e40c71ccf54a31
4
+ data.tar.gz: f7a890ecc293abbee86ecdd618df96b56525beca7eff5dda863af9c670f7156d
5
5
  SHA512:
6
- metadata.gz: 86166bafe69e1170d89b7b707aa74f758a57c531ff995a6142a58345794d9f209759edb8d53425ff839cc3027bef7d57cb49e1feeb4bc7d6f4d465bf084d65a6
7
- data.tar.gz: 68491643a1b65056d969dd08aedcca4d7b3724418b939e244bd5f923e9cc4fa6978d6150836400cfe27fe3a357418d2d73bed4bf3d8251e137f5e5546a06be89
6
+ metadata.gz: 02abfd0667c1f0068b2d012a32a2fe473119c86d130f81b0f7014f6cd634b2e771f1d8435263146ffc82140d8713fc7e1b9f0ede5bcad49b6c5ab58e4f658d4f
7
+ data.tar.gz: 010c6c6a432c09e38acca8d36b74553fe3544ef91f48ef4f273ff20513d844ac41f54054dffc1b8d5b35023f17301f8c27535a688d165dec726a698d70d6ea12
data/.rubocop.yml CHANGED
@@ -1,29 +1,45 @@
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'
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'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- habluhablu (0.1.6)
4
+ habluhablu (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,47 +1,50 @@
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 -l <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).
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/habluhablu.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = "HabluHablu makes it easier to use I18n."
12
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"
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")
16
16
 
data/lib/habluhablu.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "habluhablu/version"
4
+ require_relative "languages/languages"
4
5
 
5
6
  # Module HabluHablu
6
7
  module Habluhablu
@@ -29,15 +30,14 @@ module Habluhablu
29
30
 
30
31
  # Check if specified symbol's language does exist
31
32
  # if not, raise the custom error
32
- if File.exist?("./languages/#{language}.yml").eql?(false)
33
+ language_class = Languages.new(language)
34
+ if language_class.include_language? == false
33
35
  raise WrongSymbolError.new(language)
34
36
  end
35
37
 
36
38
  # Create a file of specified language
37
39
  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
40
+ f.write(language_class.render)
41
41
  end
42
42
  end
43
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Habluhablu
4
- VERSION = "0.1.6"
4
+ VERSION = "0.2.1"
5
5
  end
File without changes
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yaml"
4
+
5
+ # Class comment
6
+ class Languages
7
+ def initialize(language)
8
+ @language = language.to_sym
9
+ @languages = {
10
+ 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
+ }
24
+ },
25
+ en: {
26
+ "en" => {
27
+ "welcome" => "Welcome",
28
+ "registration" => "Registartion",
29
+ "log_in" => "Log in",
30
+ "log_in_with" => "Log in with", # Example: 'with Facebook'
31
+ "log_out" => "Log out",
32
+ "email_address" => "Email address",
33
+ "username" => "Username",
34
+ "password" => "Password",
35
+ "remember_me" => "Remember me",
36
+ "forgot_password" => "Forgot password?",
37
+ "do_not_have_account" => "Don't You have an account?"
38
+ }
39
+ },
40
+ es: {
41
+ "es" => {
42
+ "welcome" => "Bienvenido",
43
+ "registration" => "Regístrate",
44
+ "log_in" => "Iniciar sesión",
45
+ "log_in_with" => "Iniciar sesión con", # Example: 'with Facebook'
46
+ "log_out" => "Cerrar la sesión",
47
+ "email_address" => "Dirección de correo electrónico",
48
+ "username" => "Nombre de usuario",
49
+ "password" => "Contraseña",
50
+ "remember_me" => "Recordarme",
51
+ "forgot_password" => "¿Has olvidado tu contraseña?",
52
+ "do_not_have_account" => "¿No tienes una cuenta?"
53
+ }
54
+ },
55
+ pl: {
56
+ "pl" => {
57
+ "welcome" => "Witaj",
58
+ "registration" => "Zarejestruj się",
59
+ "log_in" => "Zaloguj się",
60
+ "log_in_with" => "Zaloguj się za pomocą", # Example: 'with Facebook'
61
+ "log_out" => "Wyolguj się",
62
+ "email_address" => "Adres email",
63
+ "username" => "Nazwa użytkownika",
64
+ "password" => "Hasło",
65
+ "remember_me" => "Zapamiętaj mnie!",
66
+ "forgot_password" => "Zapomniałeś hasła?",
67
+ "do_not_have_account" => "Nie masz jeszcze konta?"
68
+ }
69
+ },
70
+ iw: {
71
+ "iw" => {
72
+ # I'm not sure about this translation, it has to be checked!!
73
+ "welcome" => "שלום",
74
+ "registration" => "הירשם",
75
+ "log_in" => "להתחבר",
76
+ "log_in_with" => "התחבר ל", # Example: 'with Facebook'
77
+ "log_out" => "להתנתק",
78
+ "email_address" => "אימייל",
79
+ "username" => "שם משתמש",
80
+ "password" => "סיסמה",
81
+ "remember_me" => "זכור אותי",
82
+ "forgot_password" => "שכחת את הסיסמא?",
83
+ "do_not_have_account" => "אין לך חשבון?"
84
+ }
85
+ },
86
+ fr: {
87
+ "fr" => {
88
+ "welcome" => "Bienvenu", # bienvenue female
89
+ "registration" => "Créer un compte",
90
+ "log_in" => "Connexion",
91
+ "log_in_with" => "Se connecter avec", # Example: 'with Facebook'
92
+ "log_out" => "Déconnexion",
93
+ "email_address" => "Adresse e-mail",
94
+ "username" => "Nom d'utilisateur",
95
+ "password" => "Mot de passe",
96
+ "remember_me" => "Mémoriser",
97
+ "forgot_password" => "Mot de passe oublié",
98
+ "do_not_have_account" => "Vous n'avez pas de compte?"
99
+ }
100
+ },
101
+ it: {
102
+ "it" => {
103
+ "welcome" => "Benvenuto", # benvenuta female
104
+ "registration" => "Iscriviti",
105
+ "log_in" => "Accedi",
106
+ "log_in_with" => "Accedi con", # Example: 'with Facebook'
107
+ "log_out" => "Esci",
108
+ "email_address" => "Indirizzo e-mail",
109
+ "username" => "Nome utente",
110
+ "password" => "Password",
111
+ "remember_me" => "Ricordami",
112
+ "forgot_password" => "Ho dimenticato la password",
113
+ "do_not_have_account" => "Non possiedi un account?"
114
+ }
115
+ },
116
+ de: {
117
+ "de" => {
118
+ "welcome" => "Willkommen",
119
+ "registration" => "Registrieren",
120
+ "log_in" => "Anmelden",
121
+ "log_in_with" => "Anmeldung mit", # Example: 'with Facebook'
122
+ "log_out" => "Abmelden",
123
+ "email_address" => "E-Mail-Adresse",
124
+ "username" => "Nutzername",
125
+ "password" => "Passwort",
126
+ "remember_me" => "Merken",
127
+ "forgot_password" => "Passwort vergessen?",
128
+ "do_not_have_account" => "Hast du noch kein FACEBOOK-Konto?" # Change facebook!
129
+ }
130
+ }
131
+ }
132
+ end
133
+
134
+ def include_language?
135
+ @languages.key?(@language) ? true : false
136
+ end
137
+
138
+ def render
139
+ @languages.key?(@language) ? @languages[@language].to_yaml : "No language in the lib (YET!)"
140
+ end
141
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: habluhablu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.1
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-06 00:00:00.000000000 Z
11
+ date: 2021-05-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The gem allows you to generate language file with translations of the
14
14
  most useful phrases.
@@ -33,22 +33,18 @@ files:
33
33
  - bin/setup
34
34
  - exe/habluhablu
35
35
  - habluhablu.gemspec
36
- - languages/Countries_Flags.md
37
- - languages/ar.yml
38
- - languages/en.yml
39
- - languages/es.yml
40
- - languages/iw.yml
41
- - languages/pl.yml
42
36
  - lib/habluhablu.rb
43
37
  - lib/habluhablu/version.rb
44
- homepage: https://github.com/patrickgramatowski/habluhablu
38
+ - lib/languages/Countries_Flags.md
39
+ - lib/languages/languages.rb
40
+ homepage: https://github.com/patrickgramatowski/habluhablu_gem
45
41
  licenses:
46
42
  - MIT
47
43
  metadata:
48
44
  allowed_push_host: https://rubygems.org
49
- homepage_uri: https://github.com/patrickgramatowski/habluhablu
50
- source_code_uri: https://github.com/patrickgramatowski/habluhablu
51
- changelog_uri: https://github.com/patrickgramatowski/habluhablu/CHANGELOG.md
45
+ homepage_uri: https://github.com/patrickgramatowski/habluhablu_gem
46
+ source_code_uri: https://github.com/patrickgramatowski/habluhablu_gem
47
+ changelog_uri: https://github.com/patrickgramatowski/habluhablu_gem/CHANGELOG.md
52
48
  post_install_message:
53
49
  rdoc_options: []
54
50
  require_paths:
data/languages/ar.yml DELETED
@@ -1,2 +0,0 @@
1
- ar:
2
- welcome: "مرحبا"
data/languages/en.yml DELETED
@@ -1,2 +0,0 @@
1
- en:
2
- welcome: "Welcome"
data/languages/es.yml DELETED
@@ -1,2 +0,0 @@
1
- es:
2
- welcome: "Bienvenido"
data/languages/iw.yml DELETED
@@ -1,2 +0,0 @@
1
- iw:
2
- welcome: "שלום"
data/languages/pl.yml DELETED
@@ -1,2 +0,0 @@
1
- pl:
2
- welcome: "Witaj"