You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue 1:
After installing a second language pack, the user can select a preferred locale on login screen. LanguageStore.languageKey$ is being initialized with the locale the user selected on the login screen and the app and module translations are loaded according to the selected locale. However, the selected locale is being lost on page refresh or when opening a link as a new tab.
Issue 2:
The Angular lib crm/core/app/core contains some custom formatting pipes and services which inject the Angular injection token LOCALE_ID. These pipes and services use the value of LOCALE_ID to format according to the current locale. However, SCRM Angular app never provides a value for that injection token, therefore it will always have the default value en_US. As a consequence, even when the user chose a different locale on login, the translation would be provided in that user preferred locale (until page refresh) but the formatting of dates, numbers, currencies would always be made using locale en_US.
Expected Behavior
The locale that the user logged in with should be maintained across page refreshes. The frontend should be served in that locale.
If SCRM pipes and services rely on LOCALE_ID, then the value LOCALE_ID should be kept in sync with SCRM internal locale state holder LanguageStore.languageKey$, otherwise these SCRM pipes and services should use LanguageStore.languageKey$ instead for figuring out the current locale of the user. But best option would be to keep LOCALE_ID in sync with LanguageStore.languageKey$, to allow developers who extend SCRM frontend to use the standard Angular pipes which also rely on LOCALE_ID.
Actual Behavior
SCRM Internal locale state holder LanguageStore.languageKey$ looses its state on page refresh and falls back to en_US
Angular LOCALE_ID not properly initialized and synced with LanguageStore.languageKey$ and always contains en_US independent of the locale the user chose on login screen
Possible Fix
Issue 1:
The preferred locale which the user logged in with, could be stored in backend user preferences, in a cookie or in local/session storage. On app initialization, LanguageStore.languageKey$ should be initialized with the previously stored locale. This would maintain the preferred locale across page refreshes.
Issue 2:
SCRM Angular app needs to provide the initial value for LOCALE_ID and needs to find a way to keep it in sync with LanguageStore.languageKey$:
On login screen choose German language and hit login button
See frontend being served in German language. Value of LanguageStore.languageKey$ is de_DE. Value of Angular Injection Token LOCALE_ID is en_US, meaning all Angular standard and SCRM custom pipes which rely on LOCALE_ID would use English locale instead of German for formatting.
Hit F5 for a page refresh
Page is refreshed for current user. User is still logged in, but the page is served in English language and value of LanguageStore.languageKey$ equals en_US even though the user would expect to see German.
Your Environment
SuiteCRM Version used: 8.0.0-beta3
The text was updated successfully, but these errors were encountered:
I have given this a try in the full release of Suite8, and it seems the issue may now be resolved.
With a few different language packs, (French, Hebrew, Hungarian), the Language pack seems to stay applied through navigation/page refreshing/browser cache clearing
Would you be able to try this again, and let us know if you are still seeing these issues?
Sorry for coming back to it so late. Problem was more on our side. We overwrite some of the SuiteCRM Angular routes to replace the views with custom federated modules and back then we missed to apply some standard SCRM route configuration (BaseModuleResolver, BaseRecordResolver, checkSession property in route data).
With this in place, the locale handling works like a charm. Thanks for your effort.
Issue
Issue 1:
After installing a second language pack, the user can select a preferred locale on login screen.
LanguageStore.languageKey$
is being initialized with the locale the user selected on the login screen and the app and module translations are loaded according to the selected locale. However, the selected locale is being lost on page refresh or when opening a link as a new tab.Issue 2:
The Angular lib
crm/core/app/core
contains some custom formatting pipes and services which inject the Angular injection tokenLOCALE_ID
. These pipes and services use the value ofLOCALE_ID
to format according to the current locale. However, SCRM Angular app never provides a value for that injection token, therefore it will always have the default valueen_US
. As a consequence, even when the user chose a different locale on login, the translation would be provided in that user preferred locale (until page refresh) but the formatting of dates, numbers, currencies would always be made using localeen_US
.Expected Behavior
The locale that the user logged in with should be maintained across page refreshes. The frontend should be served in that locale.
If SCRM pipes and services rely on
LOCALE_ID
, then the valueLOCALE_ID
should be kept in sync with SCRM internal locale state holderLanguageStore.languageKey$
, otherwise these SCRM pipes and services should useLanguageStore.languageKey$
instead for figuring out the current locale of the user. But best option would be to keepLOCALE_ID
in sync withLanguageStore.languageKey$
, to allow developers who extend SCRM frontend to use the standard Angular pipes which also rely onLOCALE_ID
.Actual Behavior
LanguageStore.languageKey$
looses its state on page refresh and falls back toen_US
LOCALE_ID
not properly initialized and synced withLanguageStore.languageKey$
and always containsen_US
independent of the locale the user chose on login screenPossible Fix
Issue 1:
The preferred locale which the user logged in with, could be stored in backend user preferences, in a cookie or in local/session storage. On app initialization,
LanguageStore.languageKey$
should be initialized with the previously stored locale. This would maintain the preferred locale across page refreshes.Issue 2:
SCRM Angular app needs to provide the initial value for
LOCALE_ID
and needs to find a way to keep it in sync withLanguageStore.languageKey$
:Steps to Reproduce
LanguageStore.languageKey$
isde_DE
. Value of Angular Injection TokenLOCALE_ID
isen_US
, meaning all Angular standard and SCRM custom pipes which rely onLOCALE_ID
would use English locale instead of German for formatting.LanguageStore.languageKey$
equalsen_US
even though the user would expect to see German.Your Environment
The text was updated successfully, but these errors were encountered: