Fixed #323 Allow users to select a language in settings (GRN-17) (#324)

* <Added ui for language setting and migration>

* <Option to choose languages added>

* <Fixed code style>

* <Added Rspec tests>

* <sync db>

* <Sync db>

* <Generalized language settings>

* <Fixed flash message>

* Fixed las issue with i18n fallback

* <Modified fallback config>

* <Fixed code style>
This commit is contained in:
John Ma
2018-12-06 16:00:22 -05:00
committed by Jesus Federico
parent 895af7494e
commit b3f37cd3b3
11 changed files with 89 additions and 8 deletions

View File

@ -37,6 +37,10 @@ module Greenlight
config.i18n.available_locales = %w(en pt-br es ar fr de el)
config.i18n.default_locale = "en"
config.i18n.available_locales.each do |locale|
config.i18n.fallbacks[locale] = [locale, :en]
end
# Check if a loadbalancer is configured.
config.loadbalanced_configuration = ENV["LOADBALANCER_ENDPOINT"].present? && ENV["LOADBALANCER_SECRET"].present?

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
# Load available languages.
locales = "#{Rails.root}/config/locales/*"
configured_languages = []
Dir.glob(locales) do |loc|
configured_languages.push(loc.split('/').last.split('.').first)
end
Rails.configuration.languages = configured_languages

View File

@ -77,6 +77,15 @@ en:
video: Watch our tutorial on using Greenlight
upgrade: Show me how to upgrade to 2.0!
version: We've released a new version of Greenlight, but your database isn't compatible.
language_options:
default: Default (browser language)
ar: Arabic
de: German
el: Greek
en: English
es: Spanish
fr: French
pt-br: Portuguese (Brazil)
ldap_error: Unable to connect to the LDAP server. Please check your LDAP configuration in the env file and ensure your server is running.
login: Sign in
max_concurrent: The maximum number of concurrent sessions allowed has been reached!
@ -101,7 +110,7 @@ en:
or: or
with: Sign in with %{provider}
rename_recording:
rename_room:
name_placeholder: Enter a new room name...
name_update_success: Room name successfully changed!
@ -144,6 +153,7 @@ en:
settings:
account:
fullname: Fullname
language: Language
provider: Provider
image: Image
image_url: Profile Image URL

View File

@ -26,7 +26,7 @@ es:
enter_your_name: Introduce tu nombre
errors:
internal:
message: Oh no! PArece que algo falló de tu lado.
message: Oh no! Parece que algo falló de tu lado.
help: "El error ha sido registrado, vamos a revisarlo."
migration_error:
contact_admin: "Sí tu no eres administrador, contacta a uno."
@ -69,6 +69,15 @@ es:
video: Ve nuestro tutorial de como utilizar Greenlight
upgrade: Muestrame como actualizar a versión 2.0
version: Hemos publicado una nueva version de Greenlight pero tu base de datos no es compatible.
language_options:
default: Por omisión (idioma del navegador)
ar: Árabe
de: Alemán
el: Griego
en: Inglés
es: Español
fr: Francés
pt-br: Portugués (Brasil)
ldap_error: No se puede conectar al servidor LDAP. Compruebe la configuración de LDAP en el archivo "env" y asegúrate de que tu servidor está ejecutándose.
login: Ingresar
modal: