Translation and Internationalisation #113
Replies: 3 comments
-
@Sephsekla How are the keys to be registered and linked to a translation file? I do not understand how this is supposed to work. Is there documentation explaining this procedure? As I'm reviewing the WordPress internationalization documents, I don't see this method mentioned. |
Beta Was this translation helpful? Give feedback.
-
$notifications = array(
'plugin_slug_new_podcast_title' => __('Some title', 'plugin-slug'),
'plugin_slug_message' => __('Some message', 'plugin-slug'),
); In this example the translations are registered and translated in code, which has to be registered in some way for us to call and retrieve the translation. This effectively means:
|
Beta Was this translation helpful? Give feedback.
-
If a message is stored in the database, translated at the time it is emitted, this would enable:
|
Beta Was this translation helpful? Give feedback.
-
We will need notifications to be translatable. How will this be handled?
A couple of potential solutions:
sender_key
to allow a filter-based approachtextdomain
key to the notification schema, much like the approach inblock.json
.We could potentially adopt a combination of the two approaches.
The approach in https://github.com/WordPress/wp-feature-notifications/blob/develop/docs/translations.md uses a specific key for each string, which ensures all translations can be easily updated. However there's not a decision on sender_key vs textdomain.
Beta Was this translation helpful? Give feedback.
All reactions