Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
d0b73c5a
You need to sign in or sign up before continuing.
Commit
d0b73c5a
authored
Jun 22, 2019
by
Nick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: UI localization on load + update all namespaced locales
parent
c82b7066
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
22 deletions
+33
-22
admin-rendering.vue
client/components/admin/admin-rendering.vue
+1
-1
editor-modal-media.vue
client/components/editor/editor-modal-media.vue
+2
-2
editor-modal-properties.vue
client/components/editor/editor-modal-properties.vue
+8
-6
page.vue
client/themes/default/components/page.vue
+0
-6
common.js
server/controllers/common.js
+9
-0
sync-graph-locales.js
server/jobs/sync-graph-locales.js
+13
-7
No files found.
client/components/admin/admin-rendering.vue
View file @
d0b73c5a
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
img.animated.fadeInUp(src='/svg/icon-process.svg', alt='Rendering', style='width: 80px;')
img.animated.fadeInUp(src='/svg/icon-process.svg', alt='Rendering', style='width: 80px;')
.admin-header-title
.admin-header-title
.headline.primary--text.animated.fadeInLeft Rendering
.headline.primary--text.animated.fadeInLeft Rendering
.subheading.grey--text.animated.fadeInLeft.wait-p4s Configure how content is rendered
.subheading.grey--text.animated.fadeInLeft.wait-p4s Configure how content is rendered
#[v-chip(label, color='primary', small).white--text coming soon]
v-spacer
v-spacer
v-btn.animated.fadeInDown.wait-p2s(outline, color='grey', @click='refresh', large)
v-btn.animated.fadeInDown.wait-p2s(outline, color='grey', @click='refresh', large)
v-icon refresh
v-icon refresh
...
...
client/components/editor/editor-modal-media.vue
View file @
d0b73c5a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
v-card.editor-modal-media.animated.fadeInLeft(flat, tile)
v-card.editor-modal-media.animated.fadeInLeft(flat, tile)
v-container.pa-3(grid-list-lg, fluid)
v-container.pa-3(grid-list-lg, fluid)
v-layout(row, wrap)
v-layout(row, wrap)
v-flex(xs12,
xl
9)
v-flex(xs12,
lg
9)
v-card.radius-7.animated.fadeInLeft.wait-p1s(:light='!$vuetify.dark', :dark='$vuetify.dark')
v-card.radius-7.animated.fadeInLeft.wait-p1s(:light='!$vuetify.dark', :dark='$vuetify.dark')
v-card-text
v-card-text
.d-flex
.d-flex
...
@@ -125,7 +125,7 @@
...
@@ -125,7 +125,7 @@
v
-
icon
(
left
)
save_alt
v
-
icon
(
left
)
save_alt
span
{{
$t
(
'common:actions.insert'
)
}}
span
{{
$t
(
'common:actions.insert'
)
}}
v
-
flex
(
xs12
,
xl
3
)
v
-
flex
(
xs12
,
lg
3
)
v
-
card
.
radius
-
7
.
animated
.
fadeInRight
.
wait
-
p3s
(:
light
=
'!$vuetify.dark'
,
:
dark
=
'$vuetify.dark'
)
v
-
card
.
radius
-
7
.
animated
.
fadeInRight
.
wait
-
p3s
(:
light
=
'!$vuetify.dark'
,
:
dark
=
'$vuetify.dark'
)
v
-
card
-
text
v
-
card
-
text
.
d
-
flex
.
d
-
flex
...
...
client/components/editor/editor-modal-properties.vue
View file @
d0b73c5a
...
@@ -74,12 +74,13 @@
...
@@ -74,12 +74,13 @@
multiple
multiple
v-model='tags'
v-model='tags'
single-line
single-line
:hint='$t(`editor:props.tagsHint`)'
:hint='
`COMING SOON - ` +
$t(`editor:props.tagsHint`)'
persistent-hint
persistent-hint
disabled
)
)
v-divider
v-divider
v-card-text.pb-5.grey(:class='darkMode ? `darken-3-d5` : `lighten-4`')
v-card-text.pb-5.grey(:class='darkMode ? `darken-3-d5` : `lighten-4`')
v-subheader.pl-0
{{
$t
(
'editor:props.publishState'
)
}}
v-subheader.pl-0
{{
$t
(
'editor:props.publishState'
)
}}
#[v-chip.ml-3(label, color='grey', small, outline).white--text coming soon]
v-container.pa-0(fluid, grid-list-lg)
v-container.pa-0(fluid, grid-list-lg)
v-layout(row, wrap)
v-layout(row, wrap)
v-flex(xs12, md4)
v-flex(xs12, md4)
...
@@ -89,6 +90,7 @@
...
@@ -89,6 +90,7 @@
color='primary'
color='primary'
:hint='$t(`editor:props.publishToggleHint`)'
:hint='$t(`editor:props.publishToggleHint`)'
persistent-hint
persistent-hint
disabled
)
)
v-flex(xs12, md4)
v-flex(xs12, md4)
v-dialog(
v-dialog(
...
@@ -99,7 +101,7 @@
...
@@ -99,7 +101,7 @@
:return-value.sync='publishStartDate'
:return-value.sync='publishStartDate'
full-width
full-width
width='460px'
width='460px'
:disabled='!isPublished'
:disabled='!isPublished
|| true
'
)
)
v-text-field(
v-text-field(
slot='activator'
slot='activator'
...
@@ -112,7 +114,7 @@
...
@@ -112,7 +114,7 @@
clearable
clearable
:hint='$t(`editor:props.publishStartHint`)'
:hint='$t(`editor:props.publishStartHint`)'
persistent-hint
persistent-hint
:disabled='!isPublished'
:disabled='!isPublished
|| true
'
)
)
v-date-picker(
v-date-picker(
v-model='publishStartDate'
v-model='publishStartDate'
...
@@ -142,7 +144,7 @@
...
@@ -142,7 +144,7 @@
:return-value.sync='publishEndDate'
:return-value.sync='publishEndDate'
full-width
full-width
width='460px'
width='460px'
:disabled='!isPublished'
:disabled='!isPublished
|| true
'
)
)
v-text-field(
v-text-field(
slot='activator'
slot='activator'
...
@@ -155,7 +157,7 @@
...
@@ -155,7 +157,7 @@
clearable
clearable
:hint='$t(`editor:props.publishEndHint`)'
:hint='$t(`editor:props.publishEndHint`)'
persistent-hint
persistent-hint
:disabled='!isPublished'
:disabled='!isPublished
|| true
'
)
)
v-date-picker(
v-date-picker(
v-model='publishEndDate'
v-model='publishEndDate'
...
...
client/themes/default/components/page.vue
View file @
d0b73c5a
...
@@ -141,8 +141,6 @@ import Prism from '@/libs/prism/prism.js'
...
@@ -141,8 +141,6 @@ import Prism from '@/libs/prism/prism.js'
import
{
get
}
from
'vuex-pathify'
import
{
get
}
from
'vuex-pathify'
import
_
from
'lodash'
import
_
from
'lodash'
/* global siteLangs */
export
default
{
export
default
{
components
:
{
components
:
{
StatusIndicator
StatusIndicator
...
@@ -261,10 +259,6 @@ export default {
...
@@ -261,10 +259,6 @@ export default {
this
.
$store
.
commit
(
'page/SET_UPDATED_AT'
,
this
.
updatedAt
)
this
.
$store
.
commit
(
'page/SET_UPDATED_AT'
,
this
.
updatedAt
)
this
.
$store
.
commit
(
'page/SET_MODE'
,
'view'
)
this
.
$store
.
commit
(
'page/SET_MODE'
,
'view'
)
if
(
siteLangs
.
length
>
0
)
{
this
.
$i18n
.
i18next
.
changeLanguage
(
this
.
locale
)
}
},
},
mounted
()
{
mounted
()
{
Prism
.
highlightAllUnder
(
this
.
$refs
.
container
)
Prism
.
highlightAllUnder
(
this
.
$refs
.
container
)
...
...
server/controllers/common.js
View file @
d0b73c5a
...
@@ -34,6 +34,8 @@ router.get('/healthz', (req, res, next) => {
...
@@ -34,6 +34,8 @@ router.get('/healthz', (req, res, next) => {
router
.
get
([
'/e'
,
'/e/*'
],
async
(
req
,
res
,
next
)
=>
{
router
.
get
([
'/e'
,
'/e/*'
],
async
(
req
,
res
,
next
)
=>
{
const
pageArgs
=
pageHelper
.
parsePath
(
req
.
path
,
{
stripExt
:
true
})
const
pageArgs
=
pageHelper
.
parsePath
(
req
.
path
,
{
stripExt
:
true
})
_
.
set
(
res
,
'locals.siteConfig.lang'
,
pageArgs
.
locale
)
if
(
pageHelper
.
isReservedPath
(
pageArgs
.
path
))
{
if
(
pageHelper
.
isReservedPath
(
pageArgs
.
path
))
{
return
next
(
new
Error
(
'Cannot create this page because it starts with a system reserved path.'
))
return
next
(
new
Error
(
'Cannot create this page because it starts with a system reserved path.'
))
}
}
...
@@ -95,6 +97,8 @@ router.get(['/p', '/p/*'], (req, res, next) => {
...
@@ -95,6 +97,8 @@ router.get(['/p', '/p/*'], (req, res, next) => {
router
.
get
([
'/h'
,
'/h/*'
],
async
(
req
,
res
,
next
)
=>
{
router
.
get
([
'/h'
,
'/h/*'
],
async
(
req
,
res
,
next
)
=>
{
const
pageArgs
=
pageHelper
.
parsePath
(
req
.
path
,
{
stripExt
:
true
})
const
pageArgs
=
pageHelper
.
parsePath
(
req
.
path
,
{
stripExt
:
true
})
_
.
set
(
res
,
'locals.siteConfig.lang'
,
pageArgs
.
locale
)
if
(
!
WIKI
.
auth
.
checkAccess
(
req
.
user
,
[
'read:pages'
],
pageArgs
))
{
if
(
!
WIKI
.
auth
.
checkAccess
(
req
.
user
,
[
'read:pages'
],
pageArgs
))
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
'Unauthorized'
)
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
'Unauthorized'
)
return
res
.
render
(
'unauthorized'
,
{
action
:
'history'
})
return
res
.
render
(
'unauthorized'
,
{
action
:
'history'
})
...
@@ -121,6 +125,8 @@ router.get(['/h', '/h/*'], async (req, res, next) => {
...
@@ -121,6 +125,8 @@ router.get(['/h', '/h/*'], async (req, res, next) => {
router
.
get
([
'/s'
,
'/s/*'
],
async
(
req
,
res
,
next
)
=>
{
router
.
get
([
'/s'
,
'/s/*'
],
async
(
req
,
res
,
next
)
=>
{
const
pageArgs
=
pageHelper
.
parsePath
(
req
.
path
,
{
stripExt
:
true
})
const
pageArgs
=
pageHelper
.
parsePath
(
req
.
path
,
{
stripExt
:
true
})
_
.
set
(
res
,
'locals.siteConfig.lang'
,
pageArgs
.
locale
)
if
(
!
WIKI
.
auth
.
checkAccess
(
req
.
user
,
[
'read:pages'
],
pageArgs
))
{
if
(
!
WIKI
.
auth
.
checkAccess
(
req
.
user
,
[
'read:pages'
],
pageArgs
))
{
return
res
.
render
(
'unauthorized'
,
{
action
:
'source'
})
return
res
.
render
(
'unauthorized'
,
{
action
:
'source'
})
}
}
...
@@ -160,6 +166,9 @@ router.get('/*', async (req, res, next) => {
...
@@ -160,6 +166,9 @@ router.get('/*', async (req, res, next) => {
userId
:
req
.
user
.
id
,
userId
:
req
.
user
.
id
,
isPrivate
:
false
isPrivate
:
false
})
})
_
.
set
(
res
,
'locals.siteConfig.lang'
,
pageArgs
.
locale
)
if
(
page
)
{
if
(
page
)
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
page
.
title
)
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
page
.
title
)
_
.
set
(
res
.
locals
,
'pageMeta.description'
,
page
.
description
)
_
.
set
(
res
.
locals
,
'pageMeta.description'
,
page
.
description
)
...
...
server/jobs/sync-graph-locales.js
View file @
d0b73c5a
...
@@ -29,11 +29,14 @@ module.exports = async () => {
...
@@ -29,11 +29,14 @@ module.exports = async () => {
})
})
const
locales
=
_
.
sortBy
(
_
.
get
(
respList
,
'data.localization.locales'
,
[]),
'name'
).
map
(
lc
=>
({...
lc
,
isInstalled
:
(
lc
.
code
===
'en'
)}))
const
locales
=
_
.
sortBy
(
_
.
get
(
respList
,
'data.localization.locales'
,
[]),
'name'
).
map
(
lc
=>
({...
lc
,
isInstalled
:
(
lc
.
code
===
'en'
)}))
WIKI
.
cache
.
set
(
'locales'
,
locales
)
WIKI
.
cache
.
set
(
'locales'
,
locales
)
const
currentLocale
=
_
.
find
(
locales
,
[
'code'
,
WIKI
.
config
.
lang
.
code
])
// -> Download locale strings
// -> Download locale strings
if
(
WIKI
.
config
.
lang
.
autoUpdate
)
{
if
(
WIKI
.
config
.
lang
.
autoUpdate
)
{
const
activeLocales
=
WIKI
.
config
.
lang
.
namespacing
?
WIKI
.
config
.
lang
.
namespaces
:
[
WIKI
.
config
.
lang
.
code
]
for
(
const
currentLocale
of
activeLocales
)
{
const
localeInfo
=
_
.
find
(
locales
,
[
'code'
,
currentLocale
])
const
respStrings
=
await
apollo
({
const
respStrings
=
await
apollo
({
query
:
`query ($code: String!) {
query
:
`query ($code: String!) {
localization {
localization {
...
@@ -44,7 +47,7 @@ module.exports = async () => {
...
@@ -44,7 +47,7 @@ module.exports = async () => {
}
}
}`
,
}`
,
variables
:
{
variables
:
{
code
:
WIKI
.
config
.
lang
.
cod
e
code
:
currentLocal
e
}
}
})
})
const
strings
=
_
.
get
(
respStrings
,
'data.localization.strings'
,
[])
const
strings
=
_
.
get
(
respStrings
,
'data.localization.strings'
,
[])
...
@@ -56,12 +59,15 @@ module.exports = async () => {
...
@@ -56,12 +59,15 @@ module.exports = async () => {
})
})
await
WIKI
.
models
.
locales
.
query
().
update
({
await
WIKI
.
models
.
locales
.
query
().
update
({
code
:
WIKI
.
config
.
lang
.
cod
e
,
code
:
currentLocal
e
,
strings
:
lcObj
,
strings
:
lcObj
,
isRTL
:
currentLocale
.
isRTL
,
isRTL
:
localeInfo
.
isRTL
,
name
:
currentLocale
.
name
,
name
:
localeInfo
.
name
,
nativeName
:
currentLocale
.
nativeName
nativeName
:
localeInfo
.
nativeName
}).
where
(
'code'
,
WIKI
.
config
.
lang
.
code
)
}).
where
(
'code'
,
currentLocale
)
WIKI
.
logger
.
info
(
`Pulled latest locale updates for
${
localeInfo
.
name
}
from Graph endpoint: [ COMPLETED ]`
)
}
}
}
await
WIKI
.
lang
.
refreshNamespaces
()
await
WIKI
.
lang
.
refreshNamespaces
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment