decidim-term_customizer 0.16.0 → 0.16.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: c8f9e3f710555dd727f7775a85fe880c7c2da3455eeefe32dec49cc5b2053d99
4
- data.tar.gz: 1ca69a30f8f7f2165704e35b74c0406d3c7292af573703c43d2f48c1d5305791
3
+ metadata.gz: c56c7da03b27c3f194772872e09e573a25bf780149a6f1486baf8577fc991e6a
4
+ data.tar.gz: fc23655eee6230889d6f859458e5a46b8d636a09d61f8749cb186ada121c3f46
5
5
  SHA512:
6
- metadata.gz: 48969c7c92155f9bd057da0982ed7b41f2b61332ccddf7d4ce6018925c6f827979ffeaebfec29b5d97e5c2d591759a29384405974ae2583043062adf6e4b5aa5
7
- data.tar.gz: 026732b8429b8a48a9b8d38d43a9ad2bdbf4deb6822c7820afb065e9f79ba9f86904c379a63e4dd30b77b077762a88802248307288db06b8ab6a40a57ac64606
6
+ metadata.gz: a205919d276b877c7cbd4b94edf21e6bfebffd62d5c94f1a458cfe0d3147c11b92d14801e96bbb6dad02b37a4595fc02a4dfcdbec953b6b71e46e0ab45ef42f4
7
+ data.tar.gz: bd83fd4e13a93a15a71ba2dbffcfe23731d9c75541ff0bf76e930f933ed43db853457658fbc246702148c6873787266011c6cce8e54abbe2a838a6d146bcc0fa
data/README.md CHANGED
@@ -27,9 +27,12 @@ Example use cases for this module:
27
27
  - Admin wants to change the term "debate" to "discussion" for all assemblies
28
28
  within the system.
29
29
 
30
- Currently using this gem requires a bit of technical knowledge in defining the
31
- terms to be customized. The admin needs to know or find out the translation keys
32
- for the terms to be customized.
30
+ You can add the term customizations using either of the following methods:
31
+
32
+ - Search the terms from all the system translations matching the term itself or
33
+ the translation keys. This method is available in the "Add multiple" view.
34
+ - Add the term customizations for specific translation keys in case you have the
35
+ technical knowledge to find out the translation keys.
33
36
 
34
37
  ## Installation
35
38
 
@@ -62,7 +65,9 @@ To keep the gem up to date, you can use the commands above to also update it.
62
65
  active.
63
66
  - Save the set.
64
67
  - Add the translations to the set which you want to customize within the defined
65
- scope.
68
+ scope. You can either add specific translation keys manually or search the
69
+ translations from all the system's translations using the translation terms or
70
+ keys.
66
71
 
67
72
  ## Contributing
68
73
 
@@ -89,7 +89,7 @@ module Decidim
89
89
  next unless models.count.positive?
90
90
 
91
91
  manifest
92
- end
92
+ end.compact
93
93
  end
94
94
 
95
95
  def set
@@ -9,6 +9,7 @@ module Decidim
9
9
  def index
10
10
  enforce_permission_to :read, :translation
11
11
  @translations = collection
12
+ @directory = TranslationDirectory.new(current_locale)
12
13
  end
13
14
 
14
15
  def new
@@ -31,7 +31,7 @@ module Decidim
31
31
  errors.add(:key, :taken) if translation_set && translation_set.translations.where(
32
32
  locale: I18n.locale,
33
33
  key: key
34
- ).exists?
34
+ ).where.not(id: id).exists?
35
35
  end
36
36
  end
37
37
  end
@@ -21,6 +21,7 @@
21
21
  <thead>
22
22
  <tr>
23
23
  <th><%= t("models.translations.fields.key", scope: "decidim.admin") %></th>
24
+ <th><%= t("models.translations.fields.original_term", scope: "decidim.admin") %></th>
24
25
  <th><%= t("models.translations.fields.term", scope: "decidim.admin") %></th>
25
26
  <th></th>
26
27
  </tr>
@@ -31,6 +32,9 @@
31
32
  <td>
32
33
  <%= translation.key %>
33
34
  </td>
35
+ <td>
36
+ <%= @directory.translations.term(translation.key) %>
37
+ </td>
34
38
  <td>
35
39
  <%= translation.value %>
36
40
  </td>
@@ -13,7 +13,8 @@ en:
13
13
  translations:
14
14
  fields:
15
15
  key: Key
16
- term: Term
16
+ original_term: Original term
17
+ term: Customized term
17
18
  titles:
18
19
  translation_sets: Translation sets
19
20
  translations: Translations
@@ -2,7 +2,7 @@ fi:
2
2
  decidim:
3
3
  admin:
4
4
  actions:
5
- add_multiple_translations: Lisätä useita
5
+ add_multiple_translations: Lisää useita
6
6
  back: Takaisin
7
7
  new_translation_set: Uusi käännöspaketti
8
8
  new_translation: Uusi käännös
@@ -13,7 +13,8 @@ fi:
13
13
  translations:
14
14
  fields:
15
15
  key: Avain
16
- term: Termi
16
+ original_term: Alkuperäinen termi
17
+ term: Kustomoitu termi
17
18
  titles:
18
19
  translation_sets: Käännöspaketit
19
20
  translations: Käännökset
@@ -13,7 +13,8 @@ sv:
13
13
  translations:
14
14
  fields:
15
15
  key: Key
16
- term: Term
16
+ original_term: Original term
17
+ term: Customized term
17
18
  titles:
18
19
  translation_sets: Translation sets
19
20
  translations: Translations
@@ -7,6 +7,10 @@ module Decidim
7
7
  @values = flat_hash(hash || {})
8
8
  end
9
9
 
10
+ def term(key)
11
+ @values[key]
12
+ end
13
+
10
14
  def by_key(search)
11
15
  @values.select do |key|
12
16
  includes_string?(key, search, case_sensitive: true)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module TermCustomizer
5
- VERSION = "0.16.0"
5
+ VERSION = "0.16.1"
6
6
  DECIDIM_VERSION = "~> 0.16.0"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-term_customizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antti Hukkanen