Language Support in Password Pusher
Password Pusher provides support for 30 languages, allowing you to easily adapt your application to a global audience. In this documentation, we’ll cover how languages are selected and how you can customize the language settings for your users.
Language Selection
Password Pusher uses a combination of factors to determine the best language to deliver to your users. Here’s the order in which languages are selected:
- URL Parameters: If a
?locale=<value>
parameter is present in the URL, Password Pusher will use this language setting. - User Account Preference: If a user is logged in, their preferred language setting will be used. This setting can be updated by the user in their account settings.
- HTTP_ACCEPT_LANGUAGE: Password Pusher checks the
HTTP_ACCEPT_LANGUAGE
header sent by the user’s browser. This header is set based on the language selected in the browser settings. - Default Language Fallback: If none of the above methods are available, Password Pusher will fall back to a default language setting.
Custom Language Settings
You can customize the language settings for your users by updating their account preferences or by setting a default language for your application. To do this, you’ll need to:
- Update User Account Preferences: Users can update their language preferences in their account settings.
- Set a Default Language: You can set a default language for your application by updating the
default_locale
setting in yoursettings.yml
or alternatively the environment variablePWP__DEFAULT_LOCALE='fr'
.
Password Pusher makes it easy to adapt your application to a global audience. With our extensive language support, you can reach a wider audience and provide a more personalized experience for your users.
User Account Preferences
When logged in, the user account has the ability to set a preferred language from the “Edit Login Details” menu option:
To select a preferred language, the user can choose the language from the “Preferred Language” dropdown:
The Application Default Language
You can set a default language for your Password Pusher application to ensure that all users have a consistent language experience. This can be done in two ways:
Method 1: default_locale
Setting in settings.yml
You can set the default language by updating the default_locale
setting in your settings.yml
file. This setting determines the language that will be used for all users who do not have a preferred language set.
For example, to set the default language to French, you can add or update the following line in your settings.yml
file:
default_locale: fr
Method 2: The PWP__DEFAULT_LOCALE
Environment Variable
Alternatively, you can set the default language using the PWP__DEFAULT_LOCALE
environment variable. This variable can be set in your environment configuration file or in your application’s startup script.
For example, to set the default language to French using the PWP__DEFAULT_LOCALE
environment variable, you can add the following line to your environment configuration file:
PWP__DEFAULT_LOCALE='fr'
Note: When setting the default language, keep in mind that this will affect all users who do not have a preferred language set.{: .notice–info}
Disabling Individual Languages
You can customize the language support in your Password Pusher application by disabling individual languages. This can be done by modifying the list of enabled languages in the enabled_language_codes
setting in your settings.yml
file.
Example: Limiting to French, English, and Italian Only
To limit the entire application to only French, English, and Italian, you can set the enabled_language_codes
in your settings.yml
to:
enabled_language_codes:
- en # 'English'
- fr # 'Français'
- it # 'Italiano'
This will disable all other languages and only allow the specified languages to be used in the application.
Note: When disabling individual languages, keep in mind that this will affect all users and all parts of the application.
By disabling individual languages, you can tailor your application’s language support to your specific needs and ensure that only the languages you want to support are available to your users.