tybo 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/bo/utils/files/fr.json +1 -1
- data/lib/generators/bo/utils/translations.rb +29 -29
- data/lib/generators/bo_namespace/utils/files/en.json +1 -1
- data/lib/generators/bo_namespace/utils/files/fr.json +1 -1
- data/lib/generators/bo_namespace/utils/translations.rb +10 -10
- data/lib/generators/tybo_install/templates/tailwind.config.js +1 -1
- data/lib/generators/tybo_install/tybo_install_generator.rb +0 -2
- data/lib/generators/tybo_install/utils/files/en.json +1 -1
- data/lib/generators/tybo_install/utils/translations.rb +27 -28
- data/lib/tybo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19a15b6fd183a3db2358d6da62faaebeb078daf9b6966ba05c8c098e311d35ff
|
4
|
+
data.tar.gz: 22c8a8d66b275c80c04fe63f016fbcad26fa1fff50fea299ae9c04517e0c1586
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d5932d7d1506b24465b9b82768fe1d2d2a91a6c657a6733537bc7cb094afe602f7e74ecd965aaf0c701cf8863aa8eee641e201d1ad99063d6c883e1133ac3e5
|
7
|
+
data.tar.gz: 8d2b29f180b5c1acb7f54d3edd28c9c2e4f435f22acd13649a4240c7111c58243e21fd46deb7e85cd3e4266d050209ed9af5a0c55501af35a29c251e7e27cc38
|
@@ -1,31 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
def create_translations
|
4
|
-
%w[en fr].each do |
|
5
|
-
locale_file = "config/locales/bo.#{
|
4
|
+
%w[en fr].each do |locale|
|
5
|
+
locale_file = "config/locales/bo.#{locale}.yml"
|
6
6
|
unless File.exist?(locale_file)
|
7
7
|
File.write(locale_file, {
|
8
|
-
|
8
|
+
locale => {
|
9
9
|
'bo' => {
|
10
|
-
'filters' => find_existing_translation('filters',
|
11
|
-
'details' => find_existing_translation('details',
|
12
|
-
'to' => find_existing_translation('to',
|
13
|
-
'confirm_delete' => find_existing_translation('confirm_delete',
|
10
|
+
'filters' => find_existing_translation('filters', locale),
|
11
|
+
'details' => find_existing_translation('details', locale),
|
12
|
+
'to' => find_existing_translation('to', locale),
|
13
|
+
'confirm_delete' => find_existing_translation('confirm_delete', locale),
|
14
14
|
'record' => {
|
15
|
-
'created' => find_existing_translation('created',
|
16
|
-
'updated' => find_existing_translation('updated',
|
17
|
-
'destroyed' => find_existing_translation('destroyed',
|
18
|
-
'show' => find_existing_translation('show',
|
15
|
+
'created' => find_existing_translation('created', locale),
|
16
|
+
'updated' => find_existing_translation('updated', locale),
|
17
|
+
'destroyed' => find_existing_translation('destroyed', locale),
|
18
|
+
'show' => find_existing_translation('show', locale),
|
19
19
|
},
|
20
20
|
'nav' => {
|
21
|
-
'prev' => find_existing_translation('prev',
|
22
|
-
'next' => find_existing_translation('next',
|
23
|
-
'gap' => find_existing_translation('gap',
|
21
|
+
'prev' => find_existing_translation('prev', locale),
|
22
|
+
'next' => find_existing_translation('next', locale),
|
23
|
+
'gap' => find_existing_translation('gap', locale)
|
24
24
|
},
|
25
25
|
'devise' => {
|
26
|
-
'password' => find_existing_translation('password',
|
27
|
-
'new' => find_existing_translation('new',
|
28
|
-
'forgot_password' => find_existing_translation('forgot_password',
|
26
|
+
'password' => find_existing_translation('password', locale),
|
27
|
+
'new' => find_existing_translation('new', locale),
|
28
|
+
'forgot_password' => find_existing_translation('forgot_password', locale),
|
29
29
|
}
|
30
30
|
}
|
31
31
|
}
|
@@ -34,12 +34,12 @@ def create_translations
|
|
34
34
|
|
35
35
|
yaml_string = File.open locale_file
|
36
36
|
data = YAML.load yaml_string
|
37
|
-
data[
|
38
|
-
'one' => find_existing_translation(bo_model.to_s.downcase,
|
39
|
-
'others' => find_existing_translation(bo_model.to_s.pluralize.downcase,
|
40
|
-
'new' => find_existing_translation(nil,
|
41
|
-
'subtitle' => find_existing_translation("list of #{bo_model.to_s.pluralize.downcase}",
|
42
|
-
'attributes' => model_attributes(data,
|
37
|
+
data[locale]['bo'][file_name.underscore] = {
|
38
|
+
'one' => find_existing_translation(bo_model.to_s.downcase, locale),
|
39
|
+
'others' => find_existing_translation(bo_model.to_s.pluralize.downcase, locale),
|
40
|
+
'new' => find_existing_translation(nil, locale),
|
41
|
+
'subtitle' => find_existing_translation("list of #{bo_model.to_s.pluralize.downcase}", locale),
|
42
|
+
'attributes' => model_attributes(data, locale)
|
43
43
|
|
44
44
|
}
|
45
45
|
output = YAML.dump data
|
@@ -47,17 +47,17 @@ def create_translations
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
def model_attributes(data,
|
51
|
-
hash = data.dig(
|
50
|
+
def model_attributes(data, locale)
|
51
|
+
hash = data.dig(locale, 'bo', file_name.underscore, 'attributes') || {}
|
52
52
|
model_columns.each do |col|
|
53
|
-
hash[col.to_s] ||= find_existing_translation(col,
|
53
|
+
hash[col.to_s] ||= find_existing_translation(col, locale)
|
54
54
|
end
|
55
55
|
hash
|
56
56
|
end
|
57
57
|
|
58
|
-
def find_existing_translation(col,
|
59
|
-
return col.to_s.humanize.capitalize if
|
58
|
+
def find_existing_translation(col, locale)
|
59
|
+
return col.to_s.humanize.capitalize if locale == 'en'
|
60
60
|
|
61
|
-
json = JSON.parse(File.read("#{__dir__}/files/#{
|
61
|
+
json = JSON.parse(File.read("#{__dir__}/files/#{locale}.json"))
|
62
62
|
json[col.to_s]
|
63
63
|
end
|
@@ -1,20 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
def create_translations
|
4
|
-
%w[en fr].each do |
|
5
|
-
locale_file = "config/locales/bo.#{
|
4
|
+
%w[en fr].each do |locale|
|
5
|
+
locale_file = "config/locales/bo.#{locale}.yml"
|
6
6
|
yaml_string = File.open locale_file
|
7
7
|
data = YAML.load yaml_string
|
8
|
-
if data[
|
9
|
-
data[
|
8
|
+
if data[locale]['bo']['devise']['sign_in_as']
|
9
|
+
data[locale]['bo']['devise']['sign_in_as'].merge!(
|
10
10
|
{
|
11
|
-
"#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}",
|
11
|
+
"#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}", locale)
|
12
12
|
}
|
13
13
|
)
|
14
14
|
else
|
15
|
-
data[
|
15
|
+
data[locale]['bo']['devise'].merge!(
|
16
16
|
'sign_in_as' => {
|
17
|
-
"#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}",
|
17
|
+
"#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}", locale)
|
18
18
|
}
|
19
19
|
)
|
20
20
|
end
|
@@ -24,16 +24,16 @@ def create_translations
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def find_existing_translation(col,
|
27
|
+
def find_existing_translation(col, locale)
|
28
28
|
json = {
|
29
29
|
sign_in_as_administrator:{
|
30
30
|
fr: "Espace administrateur",
|
31
31
|
en: "Namespace administrator"
|
32
32
|
},
|
33
33
|
sign_in_as_user: {
|
34
|
-
fr: "Espace
|
34
|
+
fr: "Espace utilisateur",
|
35
35
|
en: "Namespace user"
|
36
36
|
}
|
37
37
|
}
|
38
|
-
json.dig(col.to_sym,
|
38
|
+
json.dig(col.to_sym, locale.to_sym)
|
39
39
|
end
|
@@ -46,7 +46,5 @@ class TyboInstallGenerator < Rails::Generators::Base
|
|
46
46
|
"application.register('dropdown', Dropdown)\napplication.register('flash', Flash)\napplication.register('search-form', SearchForm)\napplication.register('ts--search', TsSearch)\napplication.register('ts--select', TsSelect)\n"
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
50
|
-
private
|
51
49
|
end
|
52
50
|
|
@@ -1,43 +1,42 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
def create_base_translation_files
|
4
|
-
%w[en fr].each do |
|
5
|
-
locale_file = "config/locales/bo.#{
|
4
|
+
%w[en fr].each do |locale|
|
5
|
+
locale_file = "config/locales/bo.#{locale}.yml"
|
6
6
|
File.write(locale_file, {
|
7
|
-
|
7
|
+
locale => {
|
8
8
|
'bo' => {
|
9
|
-
'filters' => find_existing_translation('filters',
|
10
|
-
'show' => find_existing_translation('show',
|
11
|
-
'to' => find_existing_translation('to',
|
12
|
-
'confirm_delete' => find_existing_translation('confirm_delete',
|
9
|
+
'filters' => find_existing_translation('filters', locale),
|
10
|
+
'show' => find_existing_translation('show', locale),
|
11
|
+
'to' => find_existing_translation('to', locale),
|
12
|
+
'confirm_delete' => find_existing_translation('confirm_delete', locale),
|
13
13
|
'record' => {
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
'created' => find_existing_translation('created', locale),
|
15
|
+
'updated' => find_existing_translation('updated', locale),
|
16
|
+
'destroyed' => find_existing_translation('destroyed', locale),
|
17
17
|
},
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
}
|
18
|
+
'nav' => {
|
19
|
+
'prev' => find_existing_translation('prev', locale),
|
20
|
+
'next' => find_existing_translation('next', locale),
|
21
|
+
'gap' => find_existing_translation('gap', locale)
|
22
|
+
},
|
23
|
+
'devise' => {
|
24
|
+
'password' => find_existing_translation('password', locale),
|
25
|
+
'forgot_password' => find_existing_translation('forgot_password', locale),
|
26
|
+
'reset_password_instructions' => find_existing_translation('reset_password_instructions', locale),
|
27
|
+
'remember_me' => find_existing_translation('remember_me', locale),
|
28
|
+
'sign_in' => find_existing_translation('sign_in', locale),
|
29
|
+
'send_me_reset_password_instructions' => find_existing_translation('send_me_reset_password_instructions', locale),
|
30
|
+
'save' => find_existing_translation('save', locale),
|
32
31
|
}
|
33
32
|
}
|
34
|
-
}
|
35
|
-
|
33
|
+
}
|
34
|
+
}.to_yaml)
|
36
35
|
end
|
37
36
|
end
|
38
37
|
|
39
|
-
def find_existing_translation(col,
|
40
|
-
json = JSON.parse(File.read("#{__dir__}/files/#{
|
38
|
+
def find_existing_translation(col, locale)
|
39
|
+
json = JSON.parse(File.read("#{__dir__}/files/#{locale}.json"))
|
41
40
|
json[col.to_s]
|
42
41
|
end
|
43
42
|
|
data/lib/tybo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tybo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Delpierre
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-05-
|
12
|
+
date: 2023-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|