govuk_app_config 9.16.11 → 9.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef31f116da13cbf5b977462f7a0f01dd6fe9094fb3a4d7930098ef7e1779b55b
4
- data.tar.gz: d01c8f36ec8b6696d0a69ccefe81633ff8864a704e217efb9bfda6e7e99b16ba
3
+ metadata.gz: 5130dcd8e16063ab71e12f3d0dce77b28c0d4f83b4d7ea7a60c530f914d69e7d
4
+ data.tar.gz: 7d16c3739eaadebaabb1c6e4f62ae2c63f0bc7f05551bf55b2190d345db76637
5
5
  SHA512:
6
- metadata.gz: 7f00e5c356a1a22d346ab031d808f3d831ee4810ef315da4b74e0e9769c5ba1b9c6e959cb34711ab17df25d62869684d92b23618d7130b2f2c2abd133ab8ef19
7
- data.tar.gz: 60fd7d473af6a45420bc09043e35e823979fa150f84dc29e5bb914e000bbdba90b8276e799b2635d4fb1c44723bdc89dc15275c32ae102c8de32bf4fddd78155
6
+ metadata.gz: b2f2de9a6e91294a626277231414f90b8ea58911683b12c7ab84daec70f4fb13cd817fc8652faea32372ca7debff613c4b9f15358bdb7ab6230f4571ff0898a9
7
+ data.tar.gz: 9f0dfbff9e68c7d600dc90a4038acaee82620daae3cf52b0a35dfdfe56a65f196b59a2eff876b549a899022a659d35d87e50cb328ed45420612a0f172146554f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 9.17.0
2
+
3
+ * Add support for internationalisation of Rails framework strings ([#444](https://github.com/alphagov/govuk_app_config/pull/444))
4
+
1
5
  # 9.16.11
2
6
 
3
7
  * Update dependencies
data/README.md CHANGED
@@ -178,9 +178,19 @@ app with the following content:
178
178
  GovukContentSecurityPolicy.configure
179
179
  ```
180
180
 
181
- ## Internationalisation rules
181
+ ## Internationalisation
182
182
 
183
- Some frontend apps support languages that are not defined in the i18n gem. This provides them with our own custom rules for these languages.
183
+ Some frontend apps support languages that are not yet defined in the [rails-i18n](https://github.com/svenfuchs/rails-i18n) gem that is bundled with Rails.
184
+
185
+ The missing translations can be added to a locale file in the folder [`lib/govuk_app_config/govuk_i8n`](lib/govuk_app_config/govuk_i18n/). The [`:en`](https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/en-GB.yml) locale file in the Rails repo can be used as a guide to key names, as it contains all the keys that Rails uses for a fully internationalised language. It is not necessary to add all of these keys to your file.
186
+
187
+ See [example.yml](lib/govuk_app_config/govuk_i18n/docs/example.yml) for the most likely structure.
188
+
189
+ The translations can be enabled in the frontend application by creating a file at `config/initializers/govuk_i18n.rb` with the following content:
190
+
191
+ ```ruby
192
+ GovukI18n.configure
193
+ ```
184
194
 
185
195
  ## Time zone
186
196
 
@@ -0,0 +1,113 @@
1
+ ## Example locale file structure
2
+ ---
3
+ # example:
4
+ # date:
5
+ # abbr_day_names:
6
+ # - Sun
7
+ # - Mon
8
+ # - Tue
9
+ # - Wed
10
+ # - Thu
11
+ # - Fri
12
+ # - Sat
13
+ # abbr_month_names:
14
+ # - Jan
15
+ # - Feb
16
+ # - Mar
17
+ # - Apr
18
+ # - May
19
+ # - Jun
20
+ # - Jul
21
+ # - Aug
22
+ # - Sep
23
+ # - Oct
24
+ # - Nov
25
+ # - Dec
26
+ # day_names:
27
+ # - Sunday
28
+ # - Monday
29
+ # - Tuesday
30
+ # - Wednesday
31
+ # - Thursday
32
+ # - Friday
33
+ # - Saturday
34
+ # formats:
35
+ # default: "%Y-%m-%d"
36
+ # long: "%B %d, %Y"
37
+ # short: "%b %d"
38
+ # month_names:
39
+ # -
40
+ # - January
41
+ # - February
42
+ # - માર્ચ
43
+ # - April
44
+ # - May
45
+ # - જૂન
46
+ # - July
47
+ # - August
48
+ # - September
49
+ # - October
50
+ # - November
51
+ # - December
52
+ # order:
53
+ # - year
54
+ # - month
55
+ # - day
56
+ # datetime:
57
+ # distance_in_words:
58
+ # about_x_hours:
59
+ # one: about %{count} hour
60
+ # other: about %{count} hours
61
+ # about_x_months:
62
+ # one: about %{count} month
63
+ # other: about %{count} months
64
+ # about_x_years:
65
+ # one: about %{count} year
66
+ # other: about %{count} years
67
+ # almost_x_years:
68
+ # one: almost %{count} year
69
+ # other: almost %{count} years
70
+ # half_a_minute: half a minute
71
+ # less_than_x_seconds:
72
+ # one: less than %{count} second
73
+ # other: less than %{count} seconds
74
+ # less_than_x_minutes:
75
+ # one: less than a minute
76
+ # other: less than %{count} minutes
77
+ # over_x_years:
78
+ # one: over %{count} year
79
+ # other: over %{count} years
80
+ # x_seconds:
81
+ # one: "%{count} second"
82
+ # other: "%{count} seconds"
83
+ # x_minutes:
84
+ # one: "%{count} minute"
85
+ # other: "%{count} minutes"
86
+ # x_days:
87
+ # one: "%{count} day"
88
+ # other: "%{count} days"
89
+ # x_months:
90
+ # one: "%{count} month"
91
+ # other: "%{count} months"
92
+ # x_years:
93
+ # one: "%{count} year"
94
+ # other: "%{count} years"
95
+ # prompts:
96
+ # second: Seconds
97
+ # minute: Minute
98
+ # hour: Hour
99
+ # day: Day
100
+ # month: Month
101
+ # year: Year
102
+ # support:
103
+ # array:
104
+ # last_word_connector: ", and "
105
+ # two_words_connector: " and "
106
+ # words_connector: ", "
107
+ # time:
108
+ # am: am
109
+ # formats:
110
+ # default: "%a, %d %b %Y %H:%M:%S %z"
111
+ # long: "%B %d, %Y %H:%M"
112
+ # short: "%d %b %H:%M"
113
+ # pm: pm
@@ -0,0 +1,7 @@
1
+ module GovukI18n
2
+ GOVUK_APP_CONFIG_PATH = Gem.loaded_specs["govuk_app_config"].gem_dir
3
+
4
+ def self.configure
5
+ I18n.load_path += Dir[File.join(GOVUK_APP_CONFIG_PATH, "lib", "govuk_app_config", "govuk_i18n", "*.{yml}").to_s]
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "9.16.11".freeze
2
+ VERSION = "9.17.0".freeze
3
3
  end
@@ -1,14 +1,15 @@
1
- require "govuk_app_config/version"
2
- require "govuk_app_config/govuk_statsd"
3
1
  require "govuk_app_config/govuk_error"
4
- require "govuk_app_config/govuk_proxy/static_proxy"
5
2
  require "govuk_app_config/govuk_healthcheck"
6
3
  require "govuk_app_config/govuk_open_telemetry"
7
4
  require "govuk_app_config/govuk_prometheus_exporter"
5
+ require "govuk_app_config/govuk_proxy/static_proxy"
6
+ require "govuk_app_config/govuk_statsd"
7
+ require "govuk_app_config/version"
8
8
 
9
9
  if defined?(Rails)
10
- require "govuk_app_config/govuk_json_logging"
11
10
  require "govuk_app_config/govuk_content_security_policy"
11
+ require "govuk_app_config/govuk_i18n"
12
+ require "govuk_app_config/govuk_json_logging"
12
13
  require "govuk_app_config/govuk_timezone"
13
14
  require "govuk_app_config/railtie"
14
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_app_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.16.11
4
+ version: 9.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -366,6 +366,8 @@ files:
366
366
  - lib/govuk_app_config/govuk_healthcheck/rails_cache.rb
367
367
  - lib/govuk_app_config/govuk_healthcheck/redis.rb
368
368
  - lib/govuk_app_config/govuk_healthcheck/sidekiq_redis.rb
369
+ - lib/govuk_app_config/govuk_i18n.rb
370
+ - lib/govuk_app_config/govuk_i18n/docs/example.yml
369
371
  - lib/govuk_app_config/govuk_json_logging.rb
370
372
  - lib/govuk_app_config/govuk_json_logging/rails_ext/action_controller/metal/instrumentation.rb
371
373
  - lib/govuk_app_config/govuk_open_telemetry.rb
@@ -394,7 +396,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
394
396
  - !ruby/object:Gem::Version
395
397
  version: '0'
396
398
  requirements: []
397
- rubygems_version: 3.6.7
399
+ rubygems_version: 3.6.8
398
400
  specification_version: 4
399
401
  summary: Base configuration for GOV.UK applications
400
402
  test_files: []