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
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
Cassiopée
nghyd
Commits
a924fbbe
Commit
a924fbbe
authored
1 year ago
by
François Grand
Browse files
Options
Downloads
Patches
Plain Diff
refactor: convert (some of the) enums used in translations
refs
#621
parent
fdcad5cc
No related branches found
Branches containing commit
No related tags found
1 merge request
!224
Resolve "Utiliser des identifiants symboliques plutôt que numériques dans les fichiers"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app/services/internationalisation.service.ts
+16
-1
16 additions, 1 deletion
src/app/services/internationalisation.service.ts
src/locale/messages.en.json
+15
-15
15 additions, 15 deletions
src/locale/messages.en.json
src/locale/messages.fr.json
+15
-15
15 additions, 15 deletions
src/locale/messages.fr.json
with
46 additions
and
31 deletions
src/app/services/internationalisation.service.ts
+
16
−
1
View file @
a924fbbe
import
{
Injectable
,
isDevMode
}
from
"
@angular/core
"
;
import
{
Message
,
MessageCode
,
Observable
,
Observer
,
Nub
,
CalculatorType
,
PreBarrage
,
PbCloison
,
PbBassin
}
from
"
jalhyd
"
;
import
{
Message
,
MessageCode
,
Observable
,
Observer
,
Nub
,
CalculatorType
,
PreBarrage
,
PbCloison
,
PbBassin
,
enumValueFromString
}
from
"
jalhyd
"
;
import
{
StringMap
}
from
"
../stringmap
"
;
import
{
ApplicationSetupService
}
from
"
./app-setup.service
"
;
...
...
@@ -165,6 +165,21 @@ export class I18nService extends Observable implements Observer {
if
(
!
this
.
_Messages
)
{
return
`*** messages not loaded:
${
this
.
_currentLanguage
}
***`
;
}
// key is an enum ?
if
(
textKey
.
indexOf
(
"
INFO_ENUM_
"
)
!==
-
1
)
{
// key ends with a number ?
const
re
=
/^
((
INFO_ENUM
)
_
(
.+
)
_
)([
0-9
]
+
)
$/
;
const
res
=
textKey
.
match
(
re
);
if
(
res
!==
null
)
{
// convert end number to enum symbolic value
const
enumClass
=
res
[
3
];
const
value
=
res
[
4
];
const
val
=
enumValueFromString
(
enumClass
,
value
);
textKey
=
res
[
1
]
+
val
;
}
}
if
(
this
.
_Messages
[
textKey
]
!==
undefined
)
{
return
this
.
translateMessage
(
this
.
_Messages
[
textKey
],
vars
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/locale/messages.en.json
+
15
−
15
View file @
a924fbbe
...
...
@@ -156,9 +156,9 @@
"INFO_DIALOG_SAVE_SESSION_TITLE"
:
"Save calculator modules"
,
"INFO_EMPTY_SESSION_DIALOGUE_TEXT"
:
"Warning ! All open calculators will be lost. Continue ?"
,
"INFO_EMPTY_SESSION_DIALOGUE_TITRE"
:
"New session"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
0
"
:
"Emergent"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
1
"
:
"Quasi-emergent"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
2
"
:
"Submerged"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
EMERGENT
"
:
"Emergent"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
QUASI_EMERGENT
"
:
"Quasi-emergent"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
SUBMERGED
"
:
"Submerged"
,
"INFO_ENUM_OUVRAGE_Q_MODE_0"
:
"Weir"
,
"INFO_ENUM_OUVRAGE_Q_MODE_1"
:
"Orifice"
,
"INFO_ENUM_OUVRAGE_Q_MODE_2"
:
"Zero flow"
,
...
...
@@ -166,8 +166,8 @@
"INFO_ENUM_OUVRAGE_Q_REGIME_1"
:
"Partially submerged"
,
"INFO_ENUM_OUVRAGE_Q_REGIME_2"
:
"Submerged"
,
"INFO_ENUM_OUVRAGE_Q_REGIME_3"
:
"Zero flow"
,
"INFO_ENUM_PARFLOWREGIME_
0
"
:
"Free"
,
"INFO_ENUM_PARFLOWREGIME_
1
"
:
"Submerged"
,
"INFO_ENUM_PARFLOWREGIME_
FREE
"
:
"Free"
,
"INFO_ENUM_PARFLOWREGIME_
SUBMERGED
"
:
"Submerged"
,
"INFO_ENUM_SPECIES_1"
:
"Salmon, trout [50-100] (1)"
,
"INFO_ENUM_SPECIES_2"
:
"Mule (2)"
,
"INFO_ENUM_SPECIES_3a"
:
"Great shad (3a)"
,
...
...
@@ -188,16 +188,16 @@
"INFO_ENUM_SPECIES_10"
:
"Sunbleak, bitterling, stickleback, minnow (10)"
,
"INFO_ENUM_SPECIES_11a"
:
"European eel [yellow] (11a)"
,
"INFO_ENUM_SPECIES_11b"
:
"European Eel [glass eel] (11b)"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
0
"
:
"Weir"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
1
"
:
"Orifice"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
2
"
:
"Zero flow"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
0
"
:
"Free flow"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
1
"
:
"Partially submerged"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
2
"
:
"Submerged"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
3
"
:
"Zero flow"
,
"INFO_ENUM_STRUCTUREJETTYPE_
0
"
:
"diving"
,
"INFO_ENUM_STRUCTUREJETTYPE_
1
"
:
"surface"
,
"INFO_ENUM_STRUCTUREJETTYPE_
2
"
:
"not applicable"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
WEIR
"
:
"Weir"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
ORIFICE
"
:
"Orifice"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
NULL
"
:
"Zero flow"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
FREE
"
:
"Free flow"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
PARTIAL
"
:
"Partially submerged"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
SUBMERGED
"
:
"Submerged"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
NULL
"
:
"Zero flow"
,
"INFO_ENUM_STRUCTUREJETTYPE_
PLONGEANT
"
:
"diving"
,
"INFO_ENUM_STRUCTUREJETTYPE_
SURFACE
"
:
"surface"
,
"INFO_ENUM_STRUCTUREJETTYPE_
SO
"
:
"not applicable"
,
"INFO_CHART_BUTTON_TITLE_RESET_ZOOM"
:
"Restore default zoom"
,
"INFO_CHART_BUTTON_TITLE_EXPORT_IMAGE"
:
"Save picture"
,
"INFO_CHART_BUTTON_TITLE_ENTER_FS"
:
"Display fullscreen"
,
...
...
This diff is collapsed.
Click to expand it.
src/locale/messages.fr.json
+
15
−
15
View file @
a924fbbe
...
...
@@ -156,9 +156,9 @@
"INFO_DIALOG_SAVE_SESSION_TITLE"
:
"Enregistrer les modules de calcul"
,
"INFO_EMPTY_SESSION_DIALOGUE_TEXT"
:
"Attention ! Tous les modules de calcul ouverts seront perdus."
,
"INFO_EMPTY_SESSION_DIALOGUE_TITRE"
:
"Démarrer une nouvelle session"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
0
"
:
"Émergent"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
1
"
:
"Quasi-émergent"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
2
"
:
"Immergé"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
EMERGENT
"
:
"Émergent"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
QUASI_EMERGENT
"
:
"Quasi-émergent"
,
"INFO_ENUM_MACRORUGOFLOWTYPE_
SUBMERGED
"
:
"Immergé"
,
"INFO_ENUM_OUVRAGE_Q_MODE_0"
:
"Surface libre"
,
"INFO_ENUM_OUVRAGE_Q_MODE_1"
:
"En charge"
,
"INFO_ENUM_OUVRAGE_Q_MODE_2"
:
"Débit nul"
,
...
...
@@ -166,8 +166,8 @@
"INFO_ENUM_OUVRAGE_Q_REGIME_1"
:
"Partiellement noyé"
,
"INFO_ENUM_OUVRAGE_Q_REGIME_2"
:
"Noyé"
,
"INFO_ENUM_OUVRAGE_Q_REGIME_3"
:
"Débit nul"
,
"INFO_ENUM_PARFLOWREGIME_
0
"
:
"Dénoyé"
,
"INFO_ENUM_PARFLOWREGIME_
1
"
:
"Noyé"
,
"INFO_ENUM_PARFLOWREGIME_
FREE
"
:
"Dénoyé"
,
"INFO_ENUM_PARFLOWREGIME_
SUBMERGED
"
:
"Noyé"
,
"INFO_ENUM_SPECIES_1"
:
"Saumon, truite [50-100] (1)"
,
"INFO_ENUM_SPECIES_2"
:
"Mulets (2)"
,
"INFO_ENUM_SPECIES_3a"
:
"Grande Alose (3a)"
,
...
...
@@ -188,16 +188,16 @@
"INFO_ENUM_SPECIES_10"
:
"Able, bouvière, épinoche(tte), vairons (10)"
,
"INFO_ENUM_SPECIES_11a"
:
"Anguille européenne [jaune] (11a)"
,
"INFO_ENUM_SPECIES_11b"
:
"Anguille européenne [civelle] (11b)"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
0
"
:
"Surface libre"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
1
"
:
"En charge"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
2
"
:
"Débit nul"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
0
"
:
"Dénoyé"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
1
"
:
"Partiellement noyé"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
2
"
:
"Noyé"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
3
"
:
"Débit nul"
,
"INFO_ENUM_STRUCTUREJETTYPE_
0
"
:
"plongeant"
,
"INFO_ENUM_STRUCTUREJETTYPE_
1
"
:
"de surface"
,
"INFO_ENUM_STRUCTUREJETTYPE_
2
"
:
"sans objet"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
WEIR
"
:
"Surface libre"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
ORIFICE
"
:
"En charge"
,
"INFO_ENUM_STRUCTUREFLOWMODE_
NULL
"
:
"Débit nul"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
FREE
"
:
"Dénoyé"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
PARTIAL
"
:
"Partiellement noyé"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
SUBMERGED
"
:
"Noyé"
,
"INFO_ENUM_STRUCTUREFLOWREGIME_
NULL
"
:
"Débit nul"
,
"INFO_ENUM_STRUCTUREJETTYPE_
PLONGEANT
"
:
"plongeant"
,
"INFO_ENUM_STRUCTUREJETTYPE_
SURFACE
"
:
"de surface"
,
"INFO_ENUM_STRUCTUREJETTYPE_
SO
"
:
"sans objet"
,
"INFO_CHART_BUTTON_TITLE_RESET_ZOOM"
:
"Réinitialiser le zoom"
,
"INFO_CHART_BUTTON_TITLE_EXPORT_IMAGE"
:
"Enregistrer l'image"
,
"INFO_CHART_BUTTON_TITLE_ENTER_FS"
:
"Afficher en plein écran"
,
...
...
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