-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Hello,
I'm wondering if there is a way to register translation keys that come from other sources rather than being hardcoded.
Example use case is having a set of data (e.g. API or local constants), which need to be translated, but they would need to be changed over time.
I would envision a need for a separate scanning tool, that would require a script to be fully functional and therefore would be able to read variables/constants runtime.
Use example:
class User {
const ROLE_ADMIN = 'admin';
}
//dynamic-translations.php
rtp('enums.user-roles', User::ROLE_ADMIN);
//config/translation.php
'scan_runtime' => [
'runnable-file.php'
];
//Result:
msgctxt "enums.user-roles"
msgid "admin"
msgstr ""If one wants to change the value of ROLE_ADMIN to let's say, administrator, it would need to be done in just one place.
In theory, is this something that you would be eager to have as a part of your package?
Metadata
Metadata
Assignees
Labels
No labels