Commit Graph

24 Commits

Author SHA1 Message Date
Javi Martín
2e6644d513 Fix crash with no translation for default locale
When we were visiting a page showing the content of a record which uses
globalize and our locale was the default one and there was no
translation for the default locale, the application was crashing in some
places because there are no fallbacks for the default locale.

For example, when visiting a legislation process, the line with
`CGI.escape(title)` was crashing because `title` was `nil` for the
default locale.

We've decided to solve this issue by using any available translations as
globalize fallbacks instead of showing a 404 error or a translation
missing error because these solutions would (we thinkg) either require
modifying many places in the application or making the translatable
logic even more complex.

Initially we tried to add this solution to an initializer, but it must
be called after initializing the application so I18n.fallbacks[locale]
gets the value defined in config.i18n.fallbacks.

Also note the line:

fallbacks[locale] = I18n.fallbacks[locale] + I18n.available_locales

Doesn't mention `I18n.default_locale` because the method
`I18n.fallbacks[locale]` automatically adds the default locale.
2018-10-22 16:36:18 +02:00
voodoorai2000
8eb399150e Remove fallback rules for locales not yet added 2018-10-17 12:47:35 +02:00
voodoorai2000
3b8bb5038d Add fallback i18n locales
All other languages will fallback to the default locale

Rails also, seems to pick up dialect fallbacks, for locales with this format: es-CO, es-PE, etc, which will fallback to "es", so that is great 😌
2018-10-17 12:47:35 +02:00
voodoorai2000
f2fe230a15 Add all available locales
Only addding those with significant number of translations
2018-10-17 12:47:35 +02:00
Alberto Calderón Queimadelos
0e1d5d95a7 Revert "Make config.time_zone configurable at secrets.yml" 2018-03-08 17:12:00 +01:00
Bertocq
f9909573a3 Make config.time_zone configurable at secrets.yml 2018-03-05 11:17:25 +01:00
Bertocq
18a5bc6642 Make English the default locale 2018-01-24 11:37:43 +01:00
decabeza
5949f7abf0 uppercase all consul name 2017-09-01 12:51:31 +02:00
Bertocq
552661f0e4 Add to i18n load path files in nested folders 2017-07-05 13:30:05 +02:00
Tom Demeyer
3ba5e25801 enable dutch translation 2017-04-28 15:53:15 +02:00
rgarcia
d540be333a Makes tolk aware of french and portuguese translations 2016-10-31 11:54:26 +01:00
rgarcia
aeec264b8b makes fallback locale spanish 2016-10-31 11:50:16 +01:00
rgarcia
04ca5f7ae8 adds french and brazilian portuguese locales 2016-10-31 11:50:07 +01:00
Ignacio Aliende García
e4e2706af6 Fixes custom locales inclusion. 2016-09-20 17:34:26 +01:00
Andrés Pereira
a4dbd768ce Custom folder structure: initial documentation, code and structure folders 2016-05-31 19:57:29 +02:00
Juanjo Bazán
b946f31fc7 changes 'participacion' to 'consul' in config 2015-11-23 14:10:46 +01:00
rgarcia
8a950761d3 configures delayed_jobs 2015-09-03 22:47:54 +02:00
rgarcia
cc1e1aab60 fixes specs
for vampires
2015-08-15 01:55:39 +02:00
kikito
17fb44c70b Moves i18n initialisation to application.rb 2015-08-06 18:31:44 +02:00
rgarcia
90720457bd moves wysiwyg sanitizer to lib [#71] 2015-07-31 18:51:20 +02:00
kikito
8d9f9a21a4 Autoloads app/services 2015-07-31 16:09:50 +02:00
Alberto García Cabeza
68c45198c6 Includes fonts files 2015-07-24 11:50:08 +02:00
rgarcia
c2d5b36fb5 makes default language spanish [#5] 2015-07-16 19:22:58 +02:00
rgarcia
8db3630837 initial commit 2015-07-15 13:32:13 +02:00