Skip to content

Commit

Permalink
fix(lang): merge pull request #33 from gord007/feature/js-translation
Browse files Browse the repository at this point in the history
fix(lang): translated texts in the JavaScript
  • Loading branch information
lukas-frey authored Jul 4, 2024
2 parents 52c1bbf + 8270b8f commit 3954978
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions resources/lang/cs/translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
'open-documentation' => 'Otevřít dokumentaci',
'close' => 'Zavřít',
'back-to-default-panel' => 'Zpět',
'url-copied' => 'URL adresa byla zkopírována do schránky.',
'code-copied' => 'Kód byl zkopírován do schránky.',
];
2 changes: 2 additions & 0 deletions resources/lang/de/translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
'open-documentation' => 'Dokumentation öffnen',
'close' => 'Schließen',
'back-to-default-panel' => 'Zurück',
'url-copied' => 'URL wurde in die Zwischenablage kopiert.',
'code-copied' => 'Code wurde in die Zwischenablage kopiert.',
];
2 changes: 2 additions & 0 deletions resources/lang/en/translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
'open-documentation' => 'Open documentation',
'close' => 'Close',
'back-to-default-panel' => 'Back',
'url-copied' => 'URL was copied to your clipboard.',
'code-copied' => 'Code copied to your clipboard.',
];
2 changes: 1 addition & 1 deletion resources/views/code-block.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class="hover:cursor-pointer hover:text-white/70 flex items-center justify-center
x-on:click.prevent="
if (navigator.clipboard) {
navigator.clipboard.writeText($root.querySelector('.shiki').textContent);
new FilamentNotification().title('Code copied to your clipboard.').success().send();
new FilamentNotification().title(filamentKnowledgeBaseTranslations.codeCopied).success().send();
}
const range = document.createRange();
range.selectNodeContents($root.querySelector('.shiki'));
Expand Down
5 changes: 5 additions & 0 deletions resources/views/documentation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
url: event.target.href
});
}))
var filamentKnowledgeBaseTranslations = {
urlCopied: "@lang('filament-knowledge-base::translations.url-copied')",
codeCopied: "@lang('filament-knowledge-base::translations.code-copied')",
};
</script>
@endpush
{{--<x-filament-panels::sidebar.item activ--}}
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Pages/ViewDocumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function copyAnchorToClipboard(string $url)
$this->js(<<<JS
if (navigator.clipboard) {
await navigator.clipboard.writeText('$url').then(() => {
(new FilamentNotification()).title('URL was copied to your clipboard')
(new FilamentNotification()).title(filamentKnowledgeBaseTranslations.urlCopied)
.success()
.send();
}).catch((err) => {
Expand Down

0 comments on commit 3954978

Please sign in to comment.