1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Made WYSIWYG editor translatable

- Created new translation file for editor view.
- Added simple logic to format for tinymce.
- Aligned some of the custom labels we were using.
This commit is contained in:
Dan Brown
2022-02-06 21:17:08 +00:00
parent 921131f999
commit ef211a76ae
9 changed files with 169 additions and 22 deletions

View File

@ -0,0 +1,11 @@
@php
$en = trans('editor', [], 'en');
$lang = trans('editor');
$mergedText = [];
foreach ($en as $key => $value) {
$mergedText[$value] = $lang[$key] ?? $value;
}
@endphp
<script nonce="{{ $cspNonce }}">
window.editor_translations = @json($mergedText);
</script>

View File

@ -1,4 +1,5 @@
<div component="wysiwyg-editor"
option:wysiwyg-editor:language="{{ config('app.lang') }}"
option:wysiwyg-editor:page-id="{{ $model->id ?? 0 }}"
option:wysiwyg-editor:text-direction="{{ config('app.rtl') ? 'rtl' : 'ltr' }}"
option:wysiwyg-editor:image-upload-error-text="{{ trans('errors.image_upload_error') }}"
@ -11,4 +12,6 @@
@if($errors->has('html'))
<div class="text-neg text-small">{{ $errors->first('html') }}</div>
@endif
@endif
@include('pages.parts.editor-translations')