Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nghyd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cassiopée
nghyd
Commits
c48acac3
Commit
c48acac3
authored
11 months ago
by
AUBRY JEAN-PASCAL
Browse files
Options
Downloads
Patches
Plain Diff
fix: set english to default langague
Refs
#667
parent
8ed2bcfc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!275
Release v4.19.0
,
!264
Resolve "Cassiopée doesn't work for languages other than French and English"
Pipeline
#196581
failed
11 months ago
Stage: install
Stage: build
Stage: clean-stale-branches
Stage: deploy-dev
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/services/internationalisation.service.ts
+8
-6
8 additions, 6 deletions
src/app/services/internationalisation.service.ts
with
8 additions
and
6 deletions
src/app/services/internationalisation.service.ts
+
8
−
6
View file @
c48acac3
...
...
@@ -19,6 +19,7 @@ export class I18nService extends Observable implements Observer {
private
_availableLanguages
:
any
;
/** localized messages */
// eslint-disable-next-line @typescript-eslint/naming-convention
private
_Messages
:
StringMap
;
/** to avoid loading language files multiple times */
...
...
@@ -60,19 +61,20 @@ export class I18nService extends Observable implements Observer {
* @param code ISO 639-1 language code
*/
public
async
setLanguage
(
code
:
string
)
{
/** excluded calculators */
const
childCalculatorType
:
CalculatorType
[]
=
[
CalculatorType
.
Section
,
CalculatorType
.
Structure
,
CalculatorType
.
CloisonAval
,
CalculatorType
.
YAXN
,
CalculatorType
.
LechaptCalmon
,
CalculatorType
.
PressureLossLaw
];
// ensure 2-letter language code
code
=
code
.
substring
(
0
,
2
);
// is language supported ?
if
(
!
Object
.
keys
(
this
.
_availableLanguages
).
includes
(
code
))
{
throw
new
Error
(
`LANGUAGE_UNSUPPORTED "
${
code
}
"`
);
// Check if the language is supported, default to English if not
if
(
!
Object
.
keys
(
this
.
_availableLanguages
).
includes
(
code
))
{
code
=
"
en
"
;
// Default to English if the detected language is not supported
}
// did language change ?
// did language change?
if
(
this
.
_currentLanguage
!==
code
)
{
this
.
_currentLanguage
=
code
;
this
.
_Messages
=
undefined
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment