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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 137ef5fd100e4717b2e18d5d4172925f6fb46417c364edfdcf751825f744ea4f
4
- data.tar.gz: feaa2b04193b920be1b6299f4ce56f4c8d9e3cf8c91ea78746556488ac5b0f45
3
+ metadata.gz: 19a15b6fd183a3db2358d6da62faaebeb078daf9b6966ba05c8c098e311d35ff
4
+ data.tar.gz: 22c8a8d66b275c80c04fe63f016fbcad26fa1fff50fea299ae9c04517e0c1586
5
5
  SHA512:
6
- metadata.gz: c4d303e6b853091ea43824107ef5c3d2705ed7062330aba03b37cc83fdc6338abe3801ac7a936164982d48d2e10cc5dada3b6feed336df65d2e7a9afc204d885
7
- data.tar.gz: 1fb95391f3b3925847e32ac7c0da697ea689fa871ee9b9749dadfa0ba41ba4381569cb203120fe8a5dc3d940335e39e45076ae4f4eeca1a6ab643eba1fd5d047
6
+ metadata.gz: 5d5932d7d1506b24465b9b82768fe1d2d2a91a6c657a6733537bc7cb094afe602f7e74ecd965aaf0c701cf8863aa8eee641e201d1ad99063d6c883e1133ac3e5
7
+ data.tar.gz: 8d2b29f180b5c1acb7f54d3edd28c9c2e4f435f22acd13649a4240c7111c58243e21fd46deb7e85cd3e4266d050209ed9af5a0c55501af35a29c251e7e27cc38
@@ -22,5 +22,5 @@
22
22
  "next": "Suivant",
23
23
  "prev": "Précédent",
24
24
  "gap": "...",
25
- "show ": "Détails"
25
+ "show": "Détails"
26
26
  }
@@ -1,31 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  def create_translations
4
- %w[en fr].each do |local|
5
- locale_file = "config/locales/bo.#{local}.yml"
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
- local => {
8
+ locale => {
9
9
  'bo' => {
10
- 'filters' => find_existing_translation('filters', local),
11
- 'details' => find_existing_translation('details', local),
12
- 'to' => find_existing_translation('to', local),
13
- 'confirm_delete' => find_existing_translation('confirm_delete', local),
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', local),
16
- 'updated' => find_existing_translation('updated', local),
17
- 'destroyed' => find_existing_translation('destroyed', local),
18
- 'show' => find_existing_translation('show', local),
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', local),
22
- 'next' => find_existing_translation('next', local),
23
- 'gap' => find_existing_translation('gap', local)
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', local),
27
- 'new' => find_existing_translation('new', local),
28
- 'forgot_password' => find_existing_translation('forgot_password', local),
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[local]['bo'][file_name.underscore] = {
38
- 'one' => find_existing_translation(bo_model.to_s.downcase, local),
39
- 'others' => find_existing_translation(bo_model.to_s.pluralize.downcase, local),
40
- 'new' => find_existing_translation(nil, local),
41
- 'subtitle' => find_existing_translation("list of #{bo_model.to_s.pluralize.downcase}", local),
42
- 'attributes' => model_attributes(data, local)
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, local)
51
- hash = data.dig(local, 'bo', file_name.underscore, 'attributes') || {}
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, local)
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, local)
59
- return col.to_s.humanize.capitalize if local == 'en'
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/#{local}.json"))
61
+ json = JSON.parse(File.read("#{__dir__}/files/#{locale}.json"))
62
62
  json[col.to_s]
63
63
  end
@@ -1,4 +1,4 @@
1
1
  {
2
- "sign_in_as_administator": "Sign in as administator",
2
+ "sign_in_as_administator": "Sign in as administrator",
3
3
  "sign_in_as_user": "Sign in as user"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "sign_in_as_administator": "Espace Administrateur",
3
- "sign_in_as_user": "Espace Utilisateurs"
3
+ "sign_in_as_user": "Espace Utilisateur"
4
4
  }
@@ -1,20 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  def create_translations
4
- %w[en fr].each do |local|
5
- locale_file = "config/locales/bo.#{local}.yml"
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[local]['bo']['devise']['sign_in_as']
9
- data[local]['bo']['devise']['sign_in_as'].merge!(
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}", local)
11
+ "#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}", locale)
12
12
  }
13
13
  )
14
14
  else
15
- data[local]['bo']['devise'].merge!(
15
+ data[locale]['bo']['devise'].merge!(
16
16
  'sign_in_as' => {
17
- "#{singular_name}" => find_existing_translation("sign_in_as_#{singular_name.downcase}", local)
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, local)
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 user",
34
+ fr: "Espace utilisateur",
35
35
  en: "Namespace user"
36
36
  }
37
37
  }
38
- json.dig(col.to_sym, local.to_sym)
38
+ json.dig(col.to_sym, locale.to_sym)
39
39
  end
@@ -32,7 +32,7 @@ module.exports = {
32
32
  '950': '#241065',
33
33
  },
34
34
  'red-alert': {
35
- DEFAULT: '#D0342C',
35
+ DEFAULT: '#d0342c',
36
36
  '50': '#fdf3f3',
37
37
  '100': '#fde4e3',
38
38
  '200': '#fbcfcd',
@@ -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
 
@@ -14,7 +14,7 @@
14
14
  "full_name": "Full name",
15
15
  "updated": "Updated",
16
16
  "created": "Created",
17
- "destroyed": "Destroyed",
17
+ "destroyed": "Deleted",
18
18
  "filters": "Filters",
19
19
  "confirm_delete": "Are you sure?",
20
20
  "details": "Details",
@@ -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 |local|
5
- locale_file = "config/locales/bo.#{local}.yml"
4
+ %w[en fr].each do |locale|
5
+ locale_file = "config/locales/bo.#{locale}.yml"
6
6
  File.write(locale_file, {
7
- local => {
7
+ locale => {
8
8
  'bo' => {
9
- 'filters' => find_existing_translation('filters', local),
10
- 'show' => find_existing_translation('show', local),
11
- 'to' => find_existing_translation('to', local),
12
- 'confirm_delete' => find_existing_translation('confirm_delete', local),
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
- 'created' => find_existing_translation('created', local),
15
- 'updated' => find_existing_translation('updated', local),
16
- 'destroyed' => find_existing_translation('destroyed', local),
14
+ 'created' => find_existing_translation('created', locale),
15
+ 'updated' => find_existing_translation('updated', locale),
16
+ 'destroyed' => find_existing_translation('destroyed', locale),
17
17
  },
18
- 'nav' => {
19
- 'prev' => find_existing_translation('prev', local),
20
- 'next' => find_existing_translation('next', local),
21
- 'gap' => find_existing_translation('gap', local)
22
- },
23
- 'devise' => {
24
- 'password' => find_existing_translation('password', local),
25
- 'forgot_password' => find_existing_translation('forgot_password', local),
26
- 'reset_password_instructions' => find_existing_translation('reset_password_instructions', local),
27
- 'remember_me' => find_existing_translation('remember_me', local),
28
- 'sign_in' => find_existing_translation('sign_in', local),
29
- 'send_me_reset_password_instructions' => find_existing_translation('send_me_reset_password_instructions', local),
30
- 'save' => find_existing_translation('save', local),
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
- }.to_yaml
35
- )
33
+ }
34
+ }.to_yaml)
36
35
  end
37
36
  end
38
37
 
39
- def find_existing_translation(col, local)
40
- json = JSON.parse(File.read("#{__dir__}/files/#{local}.json"))
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
@@ -1,3 +1,3 @@
1
1
  module Tybo
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.2'
3
3
  end
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.0
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-03 00:00:00.000000000 Z
12
+ date: 2023-05-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails