From cb3ec00dcaf38c4af58d82a213e5f0e38071a71d Mon Sep 17 00:00:00 2001 From: selul Date: Thu, 8 Aug 2024 11:13:47 +0300 Subject: [PATCH] add multilanguage support for surveys --- assets/apps/dashboard/src/utils/survey.js | 1 + inc/admin/dashboard/main.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/assets/apps/dashboard/src/utils/survey.js b/assets/apps/dashboard/src/utils/survey.js index 044f35d6dc..aaa6fa04ac 100644 --- a/assets/apps/dashboard/src/utils/survey.js +++ b/assets/apps/dashboard/src/utils/survey.js @@ -34,6 +34,7 @@ if ('undefined' !== typeof window && 'undefined' !== typeof window.neveDash) { days_since_install: convertToCategory( window.neveDash.daysSinceInstall ), + language: window.neveDash.lang, license_status: window.neveDash?.license?.valid ?? 'invalid', free_version: window.neveDash?.version, pro_version: window.neveDash?.proPluginVersion, diff --git a/inc/admin/dashboard/main.php b/inc/admin/dashboard/main.php index e39e08f0b3..097497c709 100755 --- a/inc/admin/dashboard/main.php +++ b/inc/admin/dashboard/main.php @@ -410,6 +410,13 @@ private function get_localization() { if ( isset( $_GET['onboarding'] ) && $_GET['onboarding'] === 'yes' ) { $data['isOnboarding'] = true; } + $language = get_user_locale(); + $available_languages = [ + 'de_DE' => 'de', + 'de_DE_formal' => 'de', + ]; + $lang_code = isset( $available_languages[ $language ] ) ? 'de' : 'en'; + $data['lang'] = $lang_code; return $data; }