habluhablu 0.4.2 → 0.5.4

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: ab8b9081f9b8e0cfc475326f18acb28c48a9ef9d9207b747f032cb6d1fcad4cb
4
- data.tar.gz: 0cdb332c814a10d014156f5a82a6cec4c837255d763410bba9ed451d5f662c77
3
+ metadata.gz: cfa8d471176a78067f4a47724e470948f8837ba4e0d89590e8f8bacf6de38fb0
4
+ data.tar.gz: bfde6605c43270871151c1a098fd98c1668321a08556e750ce0f20b5cf95f4f7
5
5
  SHA512:
6
- metadata.gz: 71de8ca3595cb7fc32746aa9a81b16cc780acd9f39c7118ca5692a68679ff91313a2c8da955eb8f360cdad41a4f5d964e7e9a70d4a5ce1b2b7bfb97ad9e8a098
7
- data.tar.gz: 752a12b29ecacf67e2b34e7cb7b310eed329f46664e03726f76f5dba6e78df7eebe3c90b327cd9ad2b1acd0c547bb36ec1f0855a188a3732b0e4e7bf341b66f2
6
+ metadata.gz: caec6acf98aca3bbe11fa7bfdfbaf20723295853ee0396df4f982600586a425d00713be99ddd486f67233ffee15a7f0b9b6089406c3aa51c4aec8b657f582d35
7
+ data.tar.gz: df04b41d29ddb74f8c688885c27b0cd4c613c0646c8c401b7cbd9de1465f938245424610180715119ffddf034367632b0015e9171d06c4eb7489f9108583750f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- habluhablu (0.4.2)
4
+ habluhablu (0.5.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -27,6 +27,7 @@ es:
27
27
  - Oct
28
28
  - Nov
29
29
  - Dic
30
+ language: Español
30
31
  welcome: Bienvenido
31
32
  registration: Regístrate
32
33
  log_in: Iniciar sesión
@@ -37,12 +38,10 @@ es:
37
38
  password: Contraseña
38
39
  remember_me: Recordarme
39
40
  forgot_password: "¿Has olvidado tu contraseña?"
40
- do_not_have_account: "¿No tienes una cuenta?"
41
+ do_not_have_account: "¿No tienes una cuenta en %{register}?"
41
42
  lorem: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
42
43
  incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
43
44
  exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
44
45
  irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
45
46
  pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
46
47
  deserunt mollit anim id est laborum.
47
- ---
48
- translation: "¡amigo!"
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  iw:
3
+ language: עִברִית
3
4
  welcome: שלום
4
5
  registration: הירשם
5
6
  log_in: להתחבר
@@ -10,7 +11,7 @@ iw:
10
11
  password: סיסמה
11
12
  remember_me: זכור אותי
12
13
  forgot_password: שכחת את הסיסמא?
13
- do_not_have_account: אין לך חשבון?
14
+ do_not_have_account: "%{register} אין לך חשבון?"
14
15
  lorem: כדי יסוד מונחים מועמדים של, דת דפים מאמרשיחהצפה זאת. אתה דת שונה כלשהו, גם
15
16
  אחר ליום בשפות, או ניווט פולנית לחיבור ארץ. ויש בקלות ואמנות אירועים או, אל אינו
16
17
  כלכלה שתי.
data/exe/habluhablu CHANGED
@@ -16,10 +16,11 @@ OptionParser.new do |opts|
16
16
  opts.on("-t", "--translate TEXT", "Translation text example: Hello_world_test!")
17
17
  opts.on("-f", "--from SYMBOL", "From example: en")
18
18
  opts.on("-o", "--target SYMBOL", "Target language example: es")
19
+ opts.on("-j", "--json SYMBOL", "Render languages' json files.")
19
20
  end.parse!(into: args)
20
21
 
21
- information = lambda do |param|
22
- if File.exist?("config/locales/#{param}.yml")
22
+ information = lambda do |param, exe|
23
+ if File.exist?("config/locales/#{param}.#{exe}")
23
24
  puts "..."
24
25
  sleep 0.5
25
26
  puts "Everything was generated successfully!"
@@ -28,19 +29,24 @@ information = lambda do |param|
28
29
  end
29
30
  end
30
31
 
32
+ if args[:json].nil? == false
33
+ Languages.new("en").render_json(args[:json])
34
+ information.call(args[:json].split("_").first, "json")
35
+ end
36
+
31
37
  if args[:translate].nil? == false
32
38
  if args[:from].nil? == false
33
39
  translator = Translation.new(args[:translate], args[:target])
34
40
  else
35
41
  translator = Translation.new(args[:translate], args[:target], args[:from])
36
42
  end
43
+ translator.response
44
+ information.call(args[:target], "yml")
37
45
  end
38
- translator.response
39
- information.call(args[:target])
40
46
 
41
47
  if args[:language].nil? == false
42
48
  Habluhablu.hablu(args[:language])
43
- information.call(args[:language])
49
+ information.call(args[:language], "yml")
44
50
  end
45
51
 
46
52
  if args[:keyword].nil? == false
@@ -55,10 +61,10 @@ if args[:multi].nil? == false
55
61
  languages_array.each do |language|
56
62
  Habluhablu.hablu(language)
57
63
  end
58
- information.call(languages_array.last)
64
+ information.call(languages_array.last, "yml")
59
65
  end
60
66
 
61
67
  if args[:sample].nil? == false
62
68
  Habluhablu.render_sample(args[:sample])
63
- information.call("sample")
69
+ information.call("sample", "yml")
64
70
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Habluhablu
4
- VERSION = "0.4.2"
4
+ VERSION = "0.5.4"
5
5
  end
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "yaml"
4
+ require_relative "render_json"
4
5
 
5
6
  # Class comment
6
7
  class Languages
8
+ include RenderJson
7
9
  attr_writer :languages
8
10
 
9
11
  def initialize(language)
@@ -11,6 +13,7 @@ class Languages
11
13
  @languages = {
12
14
  ar: {
13
15
  "ar" => {
16
+ "language" => "العربية",
14
17
  "welcome" => "مرحبا",
15
18
  "registration" => "عنوان البريد الإلكتروني",
16
19
  "log_in" => "تسجيل الدخول",
@@ -27,6 +30,7 @@ class Languages
27
30
  },
28
31
  en: {
29
32
  "en" => {
33
+ "language" => "English",
30
34
  "welcome" => "Welcome",
31
35
  "registration" => "Registartion",
32
36
  "log_in" => "Log in",
@@ -51,6 +55,7 @@ class Languages
51
55
  Ene Feb Mar Abr May Jun Jul Ago Set Oct Nov Dic
52
56
  ]
53
57
  },
58
+ "language" => "Español",
54
59
  "welcome" => "Bienvenido",
55
60
  "registration" => "Regístrate",
56
61
  "log_in" => "Iniciar sesión",
@@ -75,6 +80,7 @@ class Languages
75
80
  Sty Lut Mar Kwi Maj Cze Lip Sie Wrz Paź Lis Gru
76
81
  ]
77
82
  },
83
+ "language" => "Polski",
78
84
  "welcome" => "Witaj",
79
85
  "registration" => "Zarejestruj się",
80
86
  "log_in" => "Zaloguj się",
@@ -92,6 +98,7 @@ class Languages
92
98
  iw: {
93
99
  "iw" => {
94
100
  # I'm not sure about this translation, it has to be checked!!
101
+ "language" => "עִברִית",
95
102
  "welcome" => "שלום",
96
103
  "registration" => "הירשם",
97
104
  "log_in" => "להתחבר",
@@ -108,6 +115,7 @@ class Languages
108
115
  },
109
116
  fr: {
110
117
  "fr" => {
118
+ "language" => "Français",
111
119
  "welcome" => "Bienvenu", # bienvenue female
112
120
  "registration" => "Créer un compte",
113
121
  "log_in" => "Connexion",
@@ -124,6 +132,7 @@ class Languages
124
132
  },
125
133
  it: {
126
134
  "it" => {
135
+ "language" => "Italiano",
127
136
  "welcome" => "Benvenuto", # benvenuta female
128
137
  "registration" => "Iscriviti",
129
138
  "log_in" => "Accedi",
@@ -140,6 +149,7 @@ class Languages
140
149
  },
141
150
  de: {
142
151
  "de" => {
152
+ "language" => "Deutsch",
143
153
  "welcome" => "Willkommen",
144
154
  "registration" => "Registrieren",
145
155
  "log_in" => "Anmelden",
@@ -156,6 +166,7 @@ class Languages
156
166
  },
157
167
  ru: {
158
168
  "ru" => {
169
+ "language" => "Русский",
159
170
  "welcome" => "Добро пожаловать",
160
171
  "registration" => "Зарегистрироваться",
161
172
  "log_in" => "Вход",
@@ -172,6 +183,7 @@ class Languages
172
183
  },
173
184
  ja: {
174
185
  "ja" => {
186
+ "language" => "日本語",
175
187
  "welcome" => "ようこそ",
176
188
  "registration" => "サインアップ",
177
189
  "log_in" => "サインイン",
@@ -194,6 +206,7 @@ class Languages
194
206
  "abbr_month_names" => %w[
195
207
  ]
196
208
  },
209
+ "language" => "Português",
197
210
  "welcome" => "Bem-vindo",
198
211
  "registration" => "Cadastrar",
199
212
  "log_in" => "Entrar",
@@ -216,6 +229,7 @@ class Languages
216
229
  "abbr_month_names" => %w[
217
230
  ]
218
231
  },
232
+ "language" => "Türkçe",
219
233
  "welcome" => "Hoşgeldiniz",
220
234
  "registration" => "Kayıt Ol",
221
235
  "log_in" => "Giriş Yap",
@@ -230,6 +244,52 @@ class Languages
230
244
  "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."
231
245
  }
232
246
  },
247
+ ko: {
248
+ "ko" => {
249
+ "date" => {
250
+ "months_names" => %w[
251
+ ],
252
+ "abbr_month_names" => %w[
253
+ ]
254
+ },
255
+ "language" => "한국어",
256
+ "welcome" => "안녕하세요",
257
+ "registration" => "가입",
258
+ "log_in" => "로그인",
259
+ "log_in_with" => "%{replace}으로 로그인", # Example: 'with Facebook' carefully!
260
+ "log_out" => "로그아웃",
261
+ "email_address" => "이메일 주소",
262
+ "username" => "사용자 이름",
263
+ "password" => "비밀번호",
264
+ "remember_me" => "사용자 이름 저장",
265
+ "forgot_password" => "비밀번호를 잊으셨나요?",
266
+ "do_not_have_account" => "%{register}계정이 없으신가요?",
267
+ "lorem" => "국민경제의 발전을 위한 중요정책의 수립에 관하여 대통령의 자문에 응하기 위하여 국민경제자문회의를 둘 수 있다."
268
+ }
269
+ },
270
+ th: {
271
+ "th" => {
272
+ "date" => {
273
+ "months_names" => %w[
274
+ ],
275
+ "abbr_month_names" => %w[
276
+ ]
277
+ },
278
+ "language" => "ไทย",
279
+ "welcome" => "ยินดีต้อนรับ",
280
+ "registration" => "ลงทะเบียน",
281
+ "log_in" => "ลงชื่อเข้าใช้",
282
+ "log_in_with" => "ลงชื่อเข้าใช้ด้วย %(replace)", # Example: 'with Facebook'
283
+ "log_out" => "ลงชื่อออก",
284
+ "email_address" => "อีเมล",
285
+ "username" => "ชื่อผู้ใช้",
286
+ "password" => "รหัสผ่าน",
287
+ "remember_me" => "จำฉันไว้",
288
+ "forgot_password" => "ลืมรหัสผ่าน",
289
+ "do_not_have_account" => "ไม่มีบัญชี %(register) ใช่ไหม",
290
+ "lorem" => "เป็นข้อความแทนที่ ใช้เพื่อลดความสนใจต่อข้อความที่นำมาแสดง สำหรับการแสดงลักษณะของ ฟอนต์ การพิมพ์และการจัดหน้า"
291
+ }
292
+ },
233
293
  example: {
234
294
  "example" => {
235
295
  "date" => {
@@ -238,6 +298,7 @@ class Languages
238
298
  "abbr_month_names" => %w[
239
299
  ]
240
300
  },
301
+ "language" => "",
241
302
  "welcome" => "",
242
303
  "registration" => "",
243
304
  "log_in" => "",
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ # Class comment
6
+ module RenderJson
7
+ def render_json(languages_input)
8
+ # "ar" || "ar_iw_pl"
9
+ languages_input = languages_input.split("_")
10
+ languages_input.each do |language|
11
+ next unless @languages.key?(language.to_sym)
12
+
13
+ File.open("config/locales/#{language}.json", "a+") do |f|
14
+ f.write(@languages[language.to_sym].to_json)
15
+ end
16
+ end
17
+ end
18
+ end
data/lib/translation.rb CHANGED
@@ -43,6 +43,3 @@ class Translation
43
43
  end
44
44
  end
45
45
  end
46
-
47
- tr = Translation.new("Hi_there", "es")
48
- tr.response
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.4.2
4
+ version: 0.5.4
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-13 00:00:00.000000000 Z
11
+ date: 2021-05-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Generate language file (for I18n) with translations of the most useful
14
14
  phrases.
@@ -31,7 +31,6 @@ files:
31
31
  - Rakefile
32
32
  - bin/console
33
33
  - bin/setup
34
- - config/locales/api_key.txt
35
34
  - config/locales/es.yml
36
35
  - config/locales/iw.yml
37
36
  - exe/habluhablu
@@ -40,6 +39,7 @@ files:
40
39
  - lib/habluhablu/version.rb
41
40
  - lib/languages/Countries_Flags.md
42
41
  - lib/languages/languages.rb
42
+ - lib/languages/render_json.rb
43
43
  - lib/translation.rb
44
44
  homepage: https://github.com/patrickgramatowski/habluhablu_gem
45
45
  licenses:
File without changes