From 77ac2f3726ea2278bd07e91ad192b260e37ebfcd Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 2 May 2025 13:23:07 +0200 Subject: [PATCH 1/2] Docs about the frontend translations merge --- src/3.x/package-development.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/3.x/package-development.md b/src/3.x/package-development.md index ffac21d..5fec9c6 100644 --- a/src/3.x/package-development.md +++ b/src/3.x/package-development.md @@ -124,4 +124,11 @@ return redirect('/')->with(['notification' => [ ]]); ``` -By default, there are 4 types: `info`, `success`, `warning`, and `error`. The style differences are defined in the [frontend config](https://github.com/rapidez/core/blob/master/config/rapidez/frontend.php), everything else is in the [Blade template](https://github.com/rapidez/core/blob/master/resources/views/components/notifications.blade.php). \ No newline at end of file +By default, there are 4 types: `info`, `success`, `warning`, and `error`. The style differences are defined in the [frontend config](https://github.com/rapidez/core/blob/master/config/rapidez/frontend.php), everything else is in the [Blade template](https://github.com/rapidez/core/blob/master/resources/views/components/notifications.blade.php). + +## Frontend translations +Rapidez adds some [frontend translations](theming.md#translations) by default. Your package might need to have some translations within Javascript. If you register a frontend.php translations file within a rapidez directory, it wil automaticly be included in the frontend translations. You can use them by referencing it by package name. For example within the [Rapidez Statamic](https://github.com/rapidez/statamic) package: + +```js +window.config.translations.packages.statamic +``` \ No newline at end of file From e175e8553e75ecedeef0d14a6127e25ea5efdef3 Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 2 May 2025 13:24:45 +0200 Subject: [PATCH 2/2] Register lang files --- src/3.x/package-development.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/3.x/package-development.md b/src/3.x/package-development.md index 5fec9c6..13d99d1 100644 --- a/src/3.x/package-development.md +++ b/src/3.x/package-development.md @@ -127,7 +127,13 @@ return redirect('/')->with(['notification' => [ By default, there are 4 types: `info`, `success`, `warning`, and `error`. The style differences are defined in the [frontend config](https://github.com/rapidez/core/blob/master/config/rapidez/frontend.php), everything else is in the [Blade template](https://github.com/rapidez/core/blob/master/resources/views/components/notifications.blade.php). ## Frontend translations -Rapidez adds some [frontend translations](theming.md#translations) by default. Your package might need to have some translations within Javascript. If you register a frontend.php translations file within a rapidez directory, it wil automaticly be included in the frontend translations. You can use them by referencing it by package name. For example within the [Rapidez Statamic](https://github.com/rapidez/statamic) package: +Rapidez adds some [frontend translations](theming.md#translations) by default. Your package might need to have some translations within Javascript. If you register a frontend.php translations file within a rapidez namespace, it wil automaticly be included in the frontend translations. + +```php +$this->loadTranslationsFrom(__DIR__ . '/../lang', 'rapidez-statamic'); +``` + +You can use them by referencing it by package name. For example within the [Rapidez Statamic](https://github.com/rapidez/statamic) package: ```js window.config.translations.packages.statamic