Commit Graph

15211 Commits

Author SHA1 Message Date
Consul Bot
51068dfd8e New translations budgets.yml (Russian) 2018-10-25 11:20:46 +02:00
Consul Bot
2ad456fb19 New translations budgets.yml (Russian) 2018-10-25 11:06:34 +02:00
Consul Bot
d93719da46 New translations budgets.yml (Russian) 2018-10-25 10:50:47 +02:00
Consul Bot
5888e6d6d3 New translations budgets.yml (Russian) 2018-10-25 10:40:55 +02:00
Consul Bot
4b9ed6c041 New translations budgets.yml (Russian) 2018-10-25 10:31:06 +02:00
Consul Bot
89bf1aeefc New translations budgets.yml (Russian) 2018-10-25 10:20:50 +02:00
Consul Bot
fddc632519 New translations budgets.yml (Russian) 2018-10-25 10:10:53 +02:00
Consul Bot
64d181cac3 New translations activerecord.yml (Valencian) 2018-10-25 09:27:19 +02:00
Consul Bot
3d0dbcdf3e New translations settings.yml (Chinese Simplified) 2018-10-25 04:30:36 +02:00
Consul Bot
ad0dfad5e0 New translations settings.yml (Chinese Simplified) 2018-10-25 04:20:27 +02:00
Consul Bot
cb45c7d907 New translations seeds.yml (Chinese Simplified) 2018-10-25 04:10:25 +02:00
Consul Bot
dea96894f6 New translations settings.yml (Chinese Simplified) 2018-10-25 04:10:23 +02:00
Consul Bot
a77b930af1 New translations seeds.yml (Chinese Simplified) 2018-10-25 04:00:27 +02:00
Consul Bot
4ae0f37d41 New translations responders.yml (Chinese Simplified) 2018-10-25 04:00:26 +02:00
Consul Bot
2557852830 New translations responders.yml (Chinese Simplified) 2018-10-25 03:56:51 +02:00
Consul Bot
9cd3c6e6d1 New translations rails.yml (Chinese Simplified) 2018-10-25 03:50:36 +02:00
Consul Bot
8e3b87638c New translations pages.yml (Chinese Simplified) 2018-10-25 03:30:31 +02:00
Consul Bot
2d8794d2c3 New translations rails.yml (Chinese Simplified) 2018-10-25 03:30:29 +02:00
Consul Bot
cc44ecc364 New translations pages.yml (Chinese Simplified) 2018-10-25 03:20:26 +02:00
Consul Bot
487ec20f49 New translations pages.yml (Chinese Simplified) 2018-10-25 03:10:25 +02:00
Consul Bot
5246839ca5 New translations pages.yml (Chinese Simplified) 2018-10-25 02:59:55 +02:00
Consul Bot
8b9a462b7a New translations pages.yml (Chinese Simplified) 2018-10-25 02:50:29 +02:00
Consul Bot
f52810219a New translations pages.yml (Chinese Simplified) 2018-10-25 02:35:08 +02:00
Consul Bot
6791ffd723 New translations pages.yml (Chinese Simplified) 2018-10-25 02:28:28 +02:00
Consul Bot
f49773ba45 New translations pages.yml (Chinese Simplified) 2018-10-25 02:20:57 +02:00
Consul Bot
2f8d705ee2 New translations pages.yml (Chinese Simplified) 2018-10-24 00:40:42 +02:00
Consul Bot
252991de37 New translations moderation.yml (Chinese Simplified) 2018-10-24 00:40:40 +02:00
Consul Bot
5fb40f929f New translations moderation.yml (Chinese Simplified) 2018-10-23 17:50:56 +02:00
Javi Martín
9404cb8b3a Fix bug with non-underscored locales
Ruby can't have hyphens in method names, so sending something like
`record.title_pt-BR` would raise an exception.

Using globalize's `localized_attr_name_for` method fixes the bug.

Thanks Marko for the tip.
2018-10-23 16:29:14 +02:00
Javi Martín
934bce5932 Don't abort the migration if the simulation fails
We think aborting the migration will generate more headaches to system
administrators, who will have to manually check and fix every invalid
record before anything can be migrated.
2018-10-23 16:29:14 +02:00
Javi Martín
7fff57a25f Add task to simulate data migration
This way we can check everything is OK before actually migrating the
data to the translations tables.
2018-10-23 16:29:14 +02:00
Javi Martín
3c48059f07 Log failed data migrations
In theory, it should never happen, but that's why exceptions exist.
2018-10-23 16:29:13 +02:00
Javi Martín
be25e5fc45 Use migrate_data option for globalize
This way the task to migrate the data doesn't have to be run manually if
these migrations weren't already executed.
2018-10-23 16:29:13 +02:00
Javi Martín
a84a0f2b7d Migrate custom pages data to their locale 2018-10-23 16:29:13 +02:00
Javi Martín
ef7be4fc55 Add task to migrate data to translation tables
We forgot to do it when we created the translation tables, and so now we
need to make sure we don't overwrite existing translations.
2018-10-23 16:29:13 +02:00
Javi Martín
ccdbdb26ba Fix poll question with non-underscored locales
Ruby can't have hyphens in method names, so sending something like
`title_pt-BR=` would raise an exception.
2018-10-23 14:23:10 +02:00
Javi Martín
b8673c1cbf Fix spec assuming German isn't available
Since we've recently added German to the available languages, and we
might support every language in the future, we're using the fictional
world language to check a locale which isn't available.

Another option could be to set the available locales in the test
environment (or the rspec helper), but then we'd have to make sure it's
executed before the call to `globalize_accessors` in the model, and it
might be confusing for developers.
2018-10-23 13:58:22 +02:00
Consul Bot
f2c7fe787a New translations pages.yml (Chinese Simplified) 2018-10-23 02:10:32 +02:00
Consul Bot
8293dcf0ad New translations pages.yml (Chinese Simplified) 2018-10-23 02:00:38 +02:00
Consul Bot
78e3e3f541 New translations pages.yml (Chinese Simplified) 2018-10-23 01:51:01 +02:00
Consul Bot
60b9be142b New translations pages.yml (Chinese Simplified) 2018-10-23 01:40:35 +02:00
Consul Bot
72392f6104 New translations pages.yml (Chinese Simplified) 2018-10-23 01:30:29 +02:00
Consul Bot
d268f9747d New translations pages.yml (Chinese Simplified) 2018-10-23 01:25:04 +02:00
Consul Bot
e3d3779395 New translations officing.yml (Chinese Simplified) 2018-10-22 20:50:44 +02:00
Consul Bot
96c2d4c295 New translations pages.yml (Chinese Simplified) 2018-10-22 20:50:43 +02:00
Javi Martín
2a1b50beba Extract method to render form fields for a locale 2018-10-22 16:36:18 +02:00
Javi Martín
361a15640f Use detect instead of select.first 2018-10-22 16:36:18 +02:00
Javi Martín
93a7cb6c0f Simplify code checking whether to enable a locale 2018-10-22 16:36:18 +02:00
Javi Martín
f5bb3c64a1 Don't run specs if there are custom fallbacks
This spec depends on French falling back to Spanish and was failing on
forks using a different fallback.
2018-10-22 16:36:18 +02:00
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