Translate plugin without specifying domain?


#1

Hii there,

I’m trying to translate my plugin (namespace Kikioboeru\Kikioboeru), so I’ve added a locale file to the following location:

plugins/Kikioboeru/Kikioboeru/src/Locale/nl_NL/kikioboeru.po

In this file, I’ve added the following:

msgid "Users"
msgstr "Gebruikers"

This can then be used by adding the following code where needed:

__d('kikioboeru/kikioboeru','Users')

Now, my question is, is there a way to do it without the need of manually specifying theKikioboeru/Kikioboeru part?
I tried using the following, but that yielded no result:

__('Users')

I can do that by moving the locale file into the main app’s locale but that’s not very clean to do.


#2

As far as I know, a plugin’s translation needs to be specified this way. If the __ function looked at all possible translation sources, how would it know how to resolve conflicts? For example, when the main app translates “field” like “grassy space” but a plugin translates it like “database column”?


#3

Ah, I see.

Guess I’ll have to roll with it like this then :slight_smile: