Support » Fixing WordPress » i18n: same slug for theme and plugin

  • Resolved Pascal Casier

    (@casiepa)


    Somebody launched this question in a local slack:
    If a plugin and a theme have the same slug, what happens when they are both doing a load_{plugin,theme}_textdomain() and there are equal strings?

    Will they live happily ‘next to each other’?
    Or will only one of the two be used because there is a merge caused by the same textdomain?

Viewing 4 replies - 1 through 4 (of 4 total)
  • It says here
    https://developer.wordpress.org/reference/functions/load_textdomain/

    If the text domain already exists, the translations will be merged. If both sets have the same string, the translation from the original value will be taken.

    Thread Starter Pascal Casier

    (@casiepa)

    @joyously,
    Thanks for that!

    So should pluginreview team and themereview team talk to each other and find a way to avoid having similar slugs (and so text domains)?

    It does seem like it could be a problem. They are mostly concerned with not having duplicates for each, separately, which is enforced by the slug has to match the textdomain for using GlotPress. But that doesn’t account for all the themes and plugins that are not in the repository. There is no way to police that.

    Thread Starter Pascal Casier

    (@casiepa)

    Just to keep all research data available in this thread:
    1. If plugin and theme translations need to be kept separate and not be merged, then a ticket for Core should be opened so that there is no merge between the two.
    2. A meta ticket for plugins and another one for teams could be opened to have a check during new submission that the new slug (that is equal to the Text Domain since WP4.6) is unique on BOTH, so in the whole wordpress.org repository. We can of course not deal with plugins and themes outside of w.org
    3. It seems that depending on being on frontend of wp-admin, plugin (on front-end) or theme (in wp-admin) translation would be used for equal strings on both sides. Tests would be needed to validate that, see https://wordpress.stackexchange.com/questions/26537/between-functions-php-widgets-and-plugins-which-is-loaded-first/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘i18n: same slug for theme and plugin’ is closed to new replies.