feat(a11y/i18n): inject user locale to chat / crisp
This commit is contained in:
parent
8a340b6f74
commit
4d1a5f230c
3 changed files with 11 additions and 1 deletions
|
@ -337,6 +337,8 @@ class ApplicationController < ActionController::Base
|
|||
extract_locale_from_accept_language_header ||
|
||||
I18n.default_locale
|
||||
|
||||
gon.locale = locale
|
||||
|
||||
I18n.with_locale(locale, &action)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
import { getConfig } from '@utils';
|
||||
const {
|
||||
crisp: { key, enabled, administrateur }
|
||||
crisp: { key, enabled, administrateur },
|
||||
locale
|
||||
} = getConfig();
|
||||
|
||||
declare const window: Window &
|
||||
typeof globalThis & {
|
||||
CRISP_WEBSITE_ID?: string | null;
|
||||
CRISP_RUNTIME_CONFIG?: {
|
||||
locale: string;
|
||||
};
|
||||
$crisp: (
|
||||
| [cmd: string, key: string, value: unknown]
|
||||
| [key: string, value: unknown]
|
||||
|
@ -15,6 +19,9 @@ declare const window: Window &
|
|||
if (enabled) {
|
||||
window.$crisp = [];
|
||||
window.CRISP_WEBSITE_ID = key;
|
||||
window.CRISP_RUNTIME_CONFIG = {
|
||||
locale: locale
|
||||
};
|
||||
|
||||
const script = document.createElement('script');
|
||||
const firstScript = document.getElementsByTagName('script')[0];
|
||||
|
|
|
@ -16,6 +16,7 @@ const Gon = z
|
|||
api_education_url: z.string().optional()
|
||||
})
|
||||
.default({}),
|
||||
locale: z.string().default('fr'),
|
||||
matomo: z
|
||||
.object({
|
||||
cookieDomain: z.string().optional(),
|
||||
|
|
Loading…
Reference in a new issue