Skip to content

Commit 79650da

Browse files
committed
Use plugin-specific i18n domain for translations
Convert __() calls in the unauthorized-handler middleware to __d('tinyauth', ...) so user-facing strings live in their own translation domain instead of leaking into the host app's default domain. Add resources/locales/tinyauth.pot generated via cake i18n extract so translators have a stable POT to base language files on.
1 parent 919f2d9 commit 79650da

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

resources/locales/tinyauth.pot

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# LANGUAGE translation of CakePHP Application
2+
# Copyright YEAR NAME <EMAIL@ADDRESS>
3+
#
4+
#, fuzzy
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: PROJECT VERSION\n"
8+
"POT-Creation-Date: 2026-05-04 02:47+0200\n"
9+
"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
10+
"Last-Translator: NAME <EMAIL@ADDRESS>\n"
11+
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
12+
"MIME-Version: 1.0\n"
13+
"Content-Type: text/plain; charset=utf-8\n"
14+
"Content-Transfer-Encoding: 8bit\n"
15+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
16+
17+
msgid "You are not authorized to access that location."
18+
msgstr ""
19+

src/Middleware/UnauthorizedHandler/ForbiddenCakeRedirectHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function handle(Exception $exception, ServerRequestInterface $request, ar
5252

5353
$response = parent::handle($exception, $request, $options);
5454

55-
$message = $options['unauthorizedMessage'] ?? __('You are not authorized to access that location.');
55+
$message = $options['unauthorizedMessage'] ?? __d('tinyauth', 'You are not authorized to access that location.');
5656
if ($message) {
5757
/** @var \Cake\Http\ServerRequest $request */
5858
$request->getFlash()->error($message);

src/Middleware/UnauthorizedHandler/ForbiddenRedirectHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function handle(Exception $exception, ServerRequestInterface $request, ar
4949

5050
$response = parent::handle($exception, $request, $options);
5151

52-
$message = $options['unauthorizedMessage'] ?? __('You are not authorized to access that location.');
52+
$message = $options['unauthorizedMessage'] ?? __d('tinyauth', 'You are not authorized to access that location.');
5353
if ($message) {
5454
/** @var \Cake\Http\ServerRequest $request */
5555
$request->getFlash()->error($message);

0 commit comments

Comments
 (0)