mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-03-07 15:16:40 +08:00
Allow fallback i18n
This commit is contained in:
parent
867ef34628
commit
e7f8503578
@ -12,8 +12,15 @@ async function loadI18n() {
|
||||
{ lang: 'en', load: () => import('../../lang/en/front-end.yml') },
|
||||
{ lang: 'zh_CN', load: () => import('../../lang/zh_CN/front-end.yml') },
|
||||
]
|
||||
const texts = await langs.find(({ lang }) => lang === blessing.locale).load()
|
||||
blessing.i18n = Object.assign(blessing.i18n || Object.create(null), texts)
|
||||
const texts = await langs.find(({ lang }) => lang === blessing.locale)
|
||||
if (texts) {
|
||||
blessing.i18n = Object.assign(blessing.i18n || Object.create(null), await texts.load())
|
||||
} else {
|
||||
blessing.i18n = Object.assign(
|
||||
blessing.i18n || Object.create(null),
|
||||
(await langs.find(({ lang }) => lang === blessing.fallback_locale)).load()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function loadModules() {
|
||||
|
@ -1,18 +1,10 @@
|
||||
@if (file_exists(public_path($path = 'app/langs/'.config('app.locale').'.js')))
|
||||
<script src="{{ url($path) }}"></script>
|
||||
@if (file_exists(resource_path($path = 'lang/overrides/'.config('app.locale').'/locale.js')))
|
||||
<script src="{{ url('resources/'.$path) }}"></script>
|
||||
@endif
|
||||
@else
|
||||
<script src="{{ url('app/langs/'.config('app.fallback_locale').'.js') }}"></script>
|
||||
@if (file_exists(resource_path($path = 'lang/overrides/'.config('app.fallback_locale').'/locale.js')))
|
||||
<script src="{{ url('resources/'.$path) }}"></script>
|
||||
@endif
|
||||
@if (file_exists(resource_path($path = 'lang/overrides/'.config('app.locale').'/locale.js')))
|
||||
<script src="{{ url('resources/'.$path) }}"></script>
|
||||
@endif
|
||||
@if (file_exists(resource_path($path = 'lang/overrides/'.config('app.fallback_locale').'/locale.js')))
|
||||
<script src="{{ url('resources/'.$path) }}"></script>
|
||||
@endif
|
||||
|
||||
<script src="{{ webpack_assets('index.js') }}"></script>
|
||||
|
||||
<!-- User custom scripts -->
|
||||
<script>{!! option('custom_js') !!}</script>
|
||||
{{-- Content added by plugins dynamically --}}
|
||||
{!! bs_footer_extra() !!}
|
||||
|
Loading…
Reference in New Issue
Block a user