Skip to content

Dynamic textdomain will not work #2

Description

@schlessera

The classes have their textdomain for localization injected through the constructor.

This will not work in all instances, as gettext() only works by checking for simple strings, it does not evaluate the PHP code to get runtime information.

Also, this does not really make sense, as multiple plugins using the messages would then provide multiple, partially conflicting translations, and each one needs to localize for all languages on their own.

I suggest providing default messages with a fixed textdomain that will be centrally localized by the community, with a mechanism to override them only when needed.

Out of the gate I can think of two possible ways of having the messages be localizable:

  1. Inject a type of config file into the class that contains identifier => strings combinations.
  2. Have the class be extended to provide localizations through either overrideable properties or methods.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions