From 5f6c293046c00d4c49122b9a45c4753537c8c538 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 8 Apr 2020 15:55:08 +0200 Subject: [PATCH] fixes in-context translation + fixes migration 20160704095606 --- CHANGELOG.md | 2 ++ app/assets/javascripts/app.js | 2 ++ config/initializers/i18n.rb | 5 +++++ db/migrate/20160704095606_create_wallets.rb | 4 ++-- doc/environment.md | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 config/initializers/i18n.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index a99a5a92c..df0b912e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Changed some default values for new installations - Compatible database with Fab-manager v1, to allow upgrades - Updated documentation +- Changed In-Context pseudo-language to Zulu instead of Acholi - Fix a bug: installation without nginx does not remove the service from the docker-compose file - Fix a bug: default twitter feed is invalid - Fix a bug: default nginx configuration does not allows secure cookies @@ -12,6 +13,7 @@ - Fix a bug: invalid link to upgrade procedure - Fix a bug: unable to access health endpoint - Fix a bug: migration 20160704095606 cannot run due to GDPR refactoring +- Fix a bug: in-context translation is not working ## v4.3.3 2020 April 1st diff --git a/app/assets/javascripts/app.js b/app/assets/javascripts/app.js index 0b08ad6cf..47902e1db 100644 --- a/app/assets/javascripts/app.js +++ b/app/assets/javascripts/app.js @@ -64,6 +64,8 @@ angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.rout $translateProvider.useMessageFormatInterpolation(); // Set the language of the instance (from ruby configuration) $translateProvider.preferredLanguage(Fablab.locale); + // In any cases, fallback to english + $translateProvider.fallbackLanguage('en'); // End the tour when the user clicks the forward or back buttons of the browser TourConfigProvider.enableNavigationInterceptors(); }]).run(['$rootScope', '$log', 'AuthService', 'Auth', 'amMoment', '$state', 'editableOptions', 'Analytics', diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb new file mode 100644 index 000000000..73785fed9 --- /dev/null +++ b/config/initializers/i18n.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +# we allow the Zulu locale (zu) as it is used for In-Context translation +# @see https://support.crowdin.com/in-context-localization/ +I18n.config.available_locales = :zu \ No newline at end of file diff --git a/db/migrate/20160704095606_create_wallets.rb b/db/migrate/20160704095606_create_wallets.rb index 0dd61ef89..54c28f583 100644 --- a/db/migrate/20160704095606_create_wallets.rb +++ b/db/migrate/20160704095606_create_wallets.rb @@ -11,8 +11,8 @@ class CreateWallets < ActiveRecord::Migration[4.2] # create all wallets execute <<-SQL - INSERT INTO wallets (user, amount, created_at, updated_at) - SELECT users.id, 0, #{DateTime.current.iso8601}, #{DateTime.current.iso8601} + INSERT INTO wallets (user_id, amount, created_at, updated_at) + SELECT users.id, 0, '#{DateTime.current.iso8601}', '#{DateTime.current.iso8601}' FROM users SQL end diff --git a/doc/environment.md b/doc/environment.md index 57248e737..61cd1ca81 100644 --- a/doc/environment.md +++ b/doc/environment.md @@ -366,7 +366,7 @@ See [Microsoft support](https://support.microsoft.com/en-us/kb/264372) for a lis If set to `true`, and the application in started into a staging environment, this will enable the Crowdin In-context translation layer for the front-end application. See [Crowdin documentation](https://support.crowdin.com/in-context-localization/) for more details about this. -Accordingly, `RAILS_LOCALE` and `APP_LOCALE` must be configured to `ach`. +Accordingly, `RAILS_LOCALE` and `APP_LOCALE` must be configured to `zu`. ## OpenLab settings