+
+
Auto-Refresh · alle {{ refreshIntervalSeconds }}s
@@ -72,12 +71,12 @@
@@ -133,10 +132,6 @@ const props = defineProps({
type: String,
default: 'Gallery',
},
- translations: {
- type: Object,
- default: () => ({}),
- },
images: {
type: Array,
default: () => [],
diff --git a/resources/js/app.js b/resources/js/app.js
index 12a8417..8f340d0 100644
--- a/resources/js/app.js
+++ b/resources/js/app.js
@@ -16,6 +16,20 @@ library.add(faPrint, faMagicWandSparkles, faXmark);
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
+const resolveTranslation = (source, path) => {
+ if (!source || !path) {
+ return undefined;
+ }
+
+ return path.split('.').reduce((acc, segment) => {
+ if (acc && Object.prototype.hasOwnProperty.call(acc, segment)) {
+ return acc[segment];
+ }
+
+ return undefined;
+ }, source);
+};
+
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
@@ -27,18 +41,29 @@ createInertiaApp({
.component('font-awesome-icon', FontAwesomeIcon) // Register Font Awesome component
.mixin({
methods: {
- __: (key, replace = {}) => {
- let translation = props.initialPage.props.translations[key];
+ __: function (key, replace = {}) {
+ const sources = [
+ this?.$page?.props?.translations,
+ props.initialPage.props.translations,
+ ];
- if (translation === undefined) {
- translation = key; // Fallback to key if translation not found
+ let translation;
+
+ for (const source of sources) {
+ const value = resolveTranslation(source, key);
+ if (value !== undefined) {
+ translation = value;
+ break;
+ }
}
- for (let placeholder in replace) {
- translation = translation.replace(`:${placeholder}`, replace[placeholder]);
- }
+ let output = translation ?? key;
- return translation;
+ Object.entries(replace).forEach(([placeholder, val]) => {
+ output = output.replace(`:${placeholder}`, val);
+ });
+
+ return output;
},
},
})
@@ -47,4 +72,4 @@ createInertiaApp({
progress: {
color: '#4B5563',
},
-});
\ No newline at end of file
+});
diff --git a/resources/lang/de/api.php b/resources/lang/de/api.php
index aaf8efb..aa04885 100644
--- a/resources/lang/de/api.php
+++ b/resources/lang/de/api.php
@@ -8,23 +8,35 @@ return [
'image_deleted_successfully' => 'Bild erfolgreich gelöscht.',
'image_or_provider_not_found' => 'Bild oder API-Anbieter nicht gefunden.',
'no_styles_available' => 'Keine Stile oder API-Anbieter aktiviert/verfügbar.',
- 'api.dark_mode' => 'Dunkler Modus',
- 'api.light_mode' => 'Heller Modus',
+ 'dark_mode' => 'Dunkler Modus',
+ 'light_mode' => 'Heller Modus',
'gallery_title' => 'Eure Bilder aus der Fotobox',
- 'navigation.previous' => 'Zurück',
- 'navigation.next' => 'Weiter',
- 'navigation.page_of' => 'Seite :currentPage von :totalPages',
- 'loading_spinner.processing_image' => 'Bild wird verarbeitet...',
- 'styled_image_display.title' => 'Neu gestyltes Bild',
- 'styled_image_display.keep_button' => 'Behalten',
- 'styled_image_display.delete_button' => 'Löschen',
+ 'navigation' => [
+ 'previous' => 'Zurück',
+ 'next' => 'Weiter',
+ 'page_of' => 'Seite :currentPage von :totalPages',
+ ],
+ 'loading_spinner' => [
+ 'processing_image' => 'Bild wird verarbeitet...',
+ ],
+ 'styled_image_display' => [
+ 'title' => 'Neu gestyltes Bild',
+ 'keep_button' => 'Behalten',
+ 'delete_button' => 'Löschen',
+ ],
'print_command_sent_successfully' => 'Druckbefehl erfolgreich gesendet.',
'failed_to_send_print_command' => 'Druckbefehl konnte nicht gesendet werden.',
- 'api.print_dialog.title' => 'Bild drucken',
- 'api.print_dialog.quantity_prompt' => 'Wie viele Kopien möchten Sie drucken?',
- 'api.print_dialog.cancel_button' => 'Abbrechen',
- 'api.print_dialog.print_button' => 'Drucken',
- 'api.download_button' => 'Herunterladen',
- 'api.download_success' => 'Download gestartet!',
- 'api.download_error' => 'Download fehlgeschlagen.',
+ 'print_dialog' => [
+ 'title' => 'Bild drucken',
+ 'quantity_prompt' => 'Wie viele Kopien möchtest du drucken?',
+ 'cancel_button' => 'Abbrechen',
+ 'print_button' => 'Drucken',
+ ],
+ 'download_button' => 'Herunterladen',
+ 'download_success' => 'Download gestartet!',
+ 'download_error' => 'Download fehlgeschlagen.',
+ 'gallery' => [
+ 'tap_to_open' => 'Zum Öffnen tippen',
+ 'empty' => 'Noch keine Bilder vorhanden.',
+ ],
];
diff --git a/resources/lang/en/api.php b/resources/lang/en/api.php
index 6f09f66..d7cc315 100644
--- a/resources/lang/en/api.php
+++ b/resources/lang/en/api.php
@@ -11,20 +11,32 @@ return [
'dark_mode' => 'Dark Mode',
'light_mode' => 'Light Mode',
'gallery_title' => 'Your images from the photobooth',
- 'navigation.previous' => 'Previous',
- 'navigation.next' => 'Next',
- 'navigation.page_of' => 'Page :currentPage of :totalPages',
- 'loading_spinner.processing_image' => 'Processing image...',
- 'styled_image_display.title' => 'Newly Styled Image',
- 'styled_image_display.keep_button' => 'Keep',
- 'styled_image_display.delete_button' => 'Delete',
+ 'navigation' => [
+ 'previous' => 'Previous',
+ 'next' => 'Next',
+ 'page_of' => 'Page :currentPage of :totalPages',
+ ],
+ 'loading_spinner' => [
+ 'processing_image' => 'Processing image...',
+ ],
+ 'styled_image_display' => [
+ 'title' => 'Newly Styled Image',
+ 'keep_button' => 'Keep',
+ 'delete_button' => 'Delete',
+ ],
'print_command_sent_successfully' => 'Print command sent successfully.',
'failed_to_send_print_command' => 'Failed to send print command.',
- 'print_dialog.title' => 'Print Image',
- 'print_dialog.quantity_prompt' => 'How many copies would you like to print?',
- 'print_dialog.cancel_button' => 'Cancel',
- 'print_dialog.print_button' => 'Print',
+ 'print_dialog' => [
+ 'title' => 'Print Image',
+ 'quantity_prompt' => 'How many copies would you like to print?',
+ 'cancel_button' => 'Cancel',
+ 'print_button' => 'Print',
+ ],
'download_button' => 'Download',
'download_success' => 'Download started!',
'download_error' => 'Download failed.',
+ 'gallery' => [
+ 'tap_to_open' => 'Tap to open',
+ 'empty' => 'No images available yet.',
+ ],
];