Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MVP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SO
OC
MVP
Commits
e66ef5fd
Commit
e66ef5fd
authored
8 months ago
by
simon.mellerin
Browse files
Options
Downloads
Patches
Plain Diff
Locale - fix on locale options in top menu bar
parent
614aeb59
No related branches found
No related tags found
1 merge request
!39
Locale - fix on locale options in top menu bar
Pipeline
#10370
passed
8 months ago
Stage: test
Stage: build
Stage: deploy
Stage: teardown
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/OcTopMenu.vue
+6
-8
6 additions, 8 deletions
src/components/OcTopMenu.vue
src/i18n.ts
+5
-0
5 additions, 0 deletions
src/i18n.ts
with
11 additions
and
8 deletions
src/components/OcTopMenu.vue
+
6
−
8
View file @
e66ef5fd
...
...
@@ -16,8 +16,9 @@ import Button from 'primevue/button'
import
Menubar
from
'
primevue/menubar
'
import
{
useRoute
,
useRouter
}
from
'
vue-router
'
import
OcLink
from
'
@/components/OcLink.vue
'
import
{
availableLocales
}
from
'
@/i18n
'
const
{
availableLocales
,
locale
,
t
}
=
useI18n
()
const
{
locale
,
t
}
=
useI18n
()
const
route
=
useRoute
()
const
router
=
useRouter
()
...
...
@@ -37,19 +38,16 @@ const menu = ref()
const
menuItems
=
computed
(()
=>
{
const
localeItems
:
MenuItem
[]
=
[]
const
localeLabels
=
{
en
:
'
English
'
,
fr
:
'
Français
'
}
for
(
const
availableLocale
of
availableLocales
)
{
for
(
const
key
in
availableLocales
)
{
localeItems
.
push
({
label
:
localeLabels
[
availableLocale
as
keyof
typeof
localeLabels
],
label
:
availableLocale
s
[
key
],
command
:
()
=>
{
router
.
push
({
name
:
route
.
name
,
params
:
{
...
route
.
params
,
lang
:
availableLocale
lang
:
key
}
})
}
...
...
This diff is collapsed.
Click to expand it.
src/i18n.ts
+
5
−
0
View file @
e66ef5fd
...
...
@@ -3,6 +3,11 @@ import messageEn from './locales/en'
import
messageFr
from
'
./locales/fr
'
import
{
setLocale
as
setYupLocale
}
from
'
yup
'
;
export
const
availableLocales
:
{
[
key
:
string
]:
string
}
=
{
en
:
'
English
'
,
fr
:
'
Français
'
}
const
i18n
=
createI18n
({
legacy
:
false
,
locale
:
'
en
'
,
...
...
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