Should shorcodes in i18n plugins be translated and if so, how?

Before I start, you should never ever use extract(). It is unreliable, and extremely hard to debug when it fails. For this specific reasons, it was (almost) completely removed from core and the codex. For more complete details, see trac ticket 22400. Along with query_posts, these are the two most commonly used and two worst functions to use.

Lets get back to the actual point. Shortcode names and attribute keys should never be made translatable, and should always be in English. It is bad practice and error prone doing it otherwise.

REASONS (SHORTCODE NAMES)

  • If a shortcode name is made translatable, any text can be used as a shortcode name. What this implies is the following:

    I have a shortcode [somename]. Now, I can decide to use it as follow, [anothername]. I download a plugin which have a shortcode called [anothername]. BANG!!! You have a naming clash. Which shortcode should be loaded

    Words with same spelling have different meanings in different languages, yet the spelling of the word is a valid word in English. Take the simple word bang. In English, is a word that descibes the sound of an explosion. In Afrikaans, which is my native tongue, it means afraid if it is translated to English. Now, I have a shordcode [afraid]. Because I am Afrikaans, I want it [bang]. I download an explosive plugin with a shortcode [bang], and BOOM!!! goes everything. (boom is the Afrikaans word for tree, yet another word valid in English and another language with different meanings

REASONS (ATTRIBUTE KEYS)

  • PHP do not allow duplicate keys. Take the following scenario

    I have a the following shortcode: [someshortcode key='value']. In my shortcode, my attributes are __( 'key' ) => 'default' and 'somekey' => 'some other value'. As I can enter any text for key, I decide to use somekey as my translated value. BOOM!!! Your shortcode fails and give unexpected output and you don’t know why. You spend hours debugging and cursing just to find out your translation is the culprit

  • Shortcode attributes are filterable if the shortcode_atts third parameter are set. Making the attribute keys translatable can have unexpected results when filtering the attributes through these filters

These are just a very few important notes to why not making shortcode names and attributes translatable.

You should only make text translatable that will be sent to screen and what will be viewable by the end user. And remember, although it does not make sense to you, stick to English when you develop themes and plugins