Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
342
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
25
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
TransFem.org
Sharkey
Commits
9dacf117
Commit
9dacf117
authored
2 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
fix(client): ローカリゼーション更新時にリロードが繰り返されることがあるのを修正
parent
26ae2dfc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/frontend/src/config.ts
+5
-1
5 additions, 1 deletion
packages/frontend/src/config.ts
packages/frontend/src/i18n.ts
+4
-0
4 additions, 0 deletions
packages/frontend/src/i18n.ts
packages/frontend/src/init.ts
+7
-4
7 additions, 4 deletions
packages/frontend/src/init.ts
with
16 additions
and
5 deletions
packages/frontend/src/config.ts
+
5
−
1
View file @
9dacf117
...
...
@@ -10,8 +10,12 @@ export const apiUrl = url + '/api';
export
const
wsUrl
=
url
.
replace
(
'
http://
'
,
'
ws://
'
).
replace
(
'
https://
'
,
'
wss://
'
)
+
'
/streaming
'
;
export
const
lang
=
miLocalStorage
.
getItem
(
'
lang
'
);
export
const
langs
=
_LANGS_
;
export
cons
t
locale
=
JSON
.
parse
(
miLocalStorage
.
getItem
(
'
locale
'
));
export
le
t
locale
=
JSON
.
parse
(
miLocalStorage
.
getItem
(
'
locale
'
));
export
const
version
=
_VERSION_
;
export
const
instanceName
=
siteName
===
'
Misskey
'
?
host
:
siteName
;
export
const
ui
=
miLocalStorage
.
getItem
(
'
ui
'
);
export
const
debug
=
miLocalStorage
.
getItem
(
'
debug
'
)
===
'
true
'
;
export
function
updateLocale
(
newLocale
)
{
locale
=
newLocale
;
}
This diff is collapsed.
Click to expand it.
packages/frontend/src/i18n.ts
+
4
−
0
View file @
9dacf117
...
...
@@ -3,3 +3,7 @@ import { locale } from '@/config';
import
{
I18n
}
from
'
@/scripts/i18n
'
;
export
const
i18n
=
markRaw
(
new
I18n
(
locale
));
export
function
updateI18n
(
newLocale
)
{
i18n
.
ts
=
newLocale
;
}
This diff is collapsed.
Click to expand it.
packages/frontend/src/init.ts
+
7
−
4
View file @
9dacf117
...
...
@@ -25,10 +25,10 @@ import JSON5 from 'json5';
import
widgets
from
'
@/widgets
'
;
import
directives
from
'
@/directives
'
;
import
components
from
'
@/components
'
;
import
{
version
,
ui
,
lang
,
host
}
from
'
@/config
'
;
import
{
version
,
ui
,
lang
,
host
,
updateLocale
}
from
'
@/config
'
;
import
{
applyTheme
}
from
'
@/scripts/theme
'
;
import
{
isDeviceDarkmode
}
from
'
@/scripts/is-device-darkmode
'
;
import
{
i18n
}
from
'
@/i18n
'
;
import
{
i18n
,
updateI18n
}
from
'
@/i18n
'
;
import
{
confirm
,
alert
,
post
,
popup
,
toast
}
from
'
@/os
'
;
import
{
stream
}
from
'
@/stream
'
;
import
*
as
sound
from
'
@/scripts/sound
'
;
...
...
@@ -87,9 +87,12 @@ import { fetchCustomEmojis } from './custom-emojis';
if
(
localeOutdated
)
{
const
res
=
await
window
.
fetch
(
`/assets/locales/
${
lang
}
.
${
version
}
.json`
);
if
(
res
.
status
===
200
)
{
miLocalStorage
.
setItem
(
'
locale
'
,
await
res
.
text
());
const
newLocale
=
await
res
.
text
();
const
parsedNewLocale
=
JSON
.
parse
(
newLocale
);
miLocalStorage
.
setItem
(
'
locale
'
,
newLocale
);
miLocalStorage
.
setItem
(
'
localeVersion
'
,
version
);
location
.
reload
();
updateLocale
(
parsedNewLocale
);
updateI18n
(
parsedNewLocale
);
}
}
//#endregion
...
...
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