diff --git a/README.md b/README.md index 889a87ef4e7..cc74b6fb1ef 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,20 @@ RAILS_ENV=private ./bin/rake db:setup Then view the site @ [http://localhost:5100/](http://localhost:5100/). +# Internationalization + +Password Pusher is currently available in **13 languages** with more languages being added often as volunteers apply. + +From within the application, the language is selectable from a language menu. Out of the box and before any language menu selection is done, the default language for the application is English. + +## Changing the Default Language + +The default language can be changed by setting an environment variable with the appropriate language code: + + PWP__DEFAULT_LOCALE=es + +For more details, a list of supported language codes and further explanation, see the bottom of this [configuration file](https://github.com/pglombardo/PasswordPusher/blob/master/config/settings.yml). + # 📼 Credits ## Translators diff --git a/config/initializers/translation.rb b/config/initializers/translation.rb index ef6e4f5bcd4..e50ee49ce10 100644 --- a/config/initializers/translation.rb +++ b/config/initializers/translation.rb @@ -2,7 +2,7 @@ I18n.available_locales = %i[ca da de en es fr it nl no pl pt-BR sr sv] # Set default locale to something other than :en -I18n.default_locale = :en +I18n.default_locale = Settings.default_locale TranslationIO.configure do |config| config.api_key = 'cc6a66a15e02433aa9d0afeb39835b8c' diff --git a/config/routes.rb b/config/routes.rb index 09284d95947..24400edb8c8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,6 +31,6 @@ get '/slack_direct_install', to: redirect("https://slack.com/oauth/authorize?client_id=#{SLACK_CLIENT_ID}&scope=commands", status: 302) get '/pages/*id' => 'pages#show', as: :page, format: false resources :feedbacks, only: %i[new create] - root to: 'passwords#new' + root to: 'passwords#new', :locale => I18n.default_locale end end diff --git a/config/settings.yml b/config/settings.yml index d9e7a7a7b76..215d7358d32 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -4,9 +4,10 @@ # this new config gem, then we'll migrate entirely to the new Settings # format for private instances too. -# Logins are not yet supported in private instances yet due to a bit more support work -# that needs to be done first. -# e.g. how to hook up an email MTA. Coming soon. +# Logins are disabled by default since they require an MTA (email) server +# available to send emails through. +# For instructions on how to enable logins, see this page: +# https://github.com/pglombardo/PasswordPusher/discussions/276 enable_logins: false # The domain (without protocol) where this instance is hosted @@ -36,6 +37,10 @@ mail: # See config/initializers/devise.rb where this is used # mailer_sender: '"Password Pusher" ' +# List of supported languages indexed by language code. This is used +# to build the in application language menu. +# +# : '' language_codes: ca: 'Català' da: 'Dansk' @@ -51,3 +56,9 @@ language_codes: sr: 'Српски' sv: 'Svenska' +# The default language for the application. This must be one of the +# valid/supported language codes from the list above. +# Example: default_locale: :es +# Environment Variable Override: PWP__DEFAULT_LOCALE='es' +default_locale: :en +