In This Text Domain?

What does "In this text domain" mean? How does it work?
How would I apply a text change rule only to a specific area of the admin?
Like only on the admin menu for example?

Thanks

  • Timothy Bowers

    I'll go over this again for you :slight_smile:

    So within a plugin there can be text lets say:

    __('This is some text')

    That has no domain, so any changes could not be specifically targeted.

    So lets say that we have two plugins using the same text, this can be a horse racing site. In one plugin it deals with names for a Pony and have "Pony" in the gambling section (a different plugin) it uses the term "Pony" to represent a monetary value (I occasionally like to gamble in casinos but not horses)

    Perhaps we want to change Pony to Horses (where it actually means horses and because its not a horse of a small breed), but hold on making a change could affect that right across the board because the admin text change doesn't know how to differentiate........... Unless there is a text domain specified and the text in question has a text domain.

    So What Do We Do?

    Give it a text domain, and how do we do that????

    __('Pony','horse_stats')

    __('Pony','gambling')

    The text domain will depend on the developer of the plugin/theme. In this instance we have one plugin using "horse_stats" and the other using "gambling".

    Now we can target them both individually!

    So in our plugin, we can target those text domains individually and ensure we do not make sweeping changes that might cause a negative affect.

    Does that better enlighten you?

    Take care.

  • coreymj78

    No. What does __('Pony','horse_stats') mean? What is "horse_stats" ?

    Is that the name of a plugin? And does this mean that if horse_stats is the name of the plugin and I enter "__('Pony','horse_stats')" into the text domain field that it will change Pony to Horses, but only in the admin areas that the horse_stats plugin affects?

    This ist he part that's still foggy for me. I'm sure I sound dumb and I should probably just understand this, but I don't. Are my above assumptions correct?

    Thanks.

  • Timothy Bowers

    Hey again.

    No. What does __('Pony','horse_stats') mean? What is "horse_stats" ?

    Its what ever you want it to be or the developer who made it. In the case of MarketPress I believe its "mp". Pro Sites is psts. It can relate to the plugin and I suppose really it should for consistency and ease of use. but it could be anything.

    This ist he part that's still foggy for me. I'm sure I sound dumb and I should probably just understand this, but I don't. Are my above assumptions correct?

    Nahh you don't sound dumb at all. Sometimes it takes a little to get your head around things, I know it does me. :slight_smile:

    But yeah your assumptions are correct.

    I think for Dashboard you don't need a text domain. Just the word you want to change.

    Take care.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.