Home » Tutorials » How to exclude WordPress shortcodes from translation

How to exclude WordPress shortcodes from translation

Many WordPress websites use shortcodes. Until now, clients were required to explain these shortcodes to translators in order to prevent accidental translation of these codes. New developments in ICanLocalize allow clients to enter a list of shortcodes, which are automatically blocked by the system during translation. In this way, clients will not be required to pay for the translation of these words and translators will not need to worry about what not to translate.

How to enter your list of shortcodes to be excluded?

ICanLocalize now allows you to create a list of shortcodes that are required to be excluded for each website.

When your website project is fully set up in WPML (after activating ICanLocalize as your translation service), go to WPML >Translation Management, scroll down to the ICanLocalize account status box, and click on the “Project Page” link.

 

how-to-exclude-shortcodes-1

 

The project page will pop up. Scroll down to the bottom of the page to reach the Project Administration section and click on the Blocked shortcodes list button.

 

how-to-exclude-shortcodes-2

 

In this list, you will see two sections: your website’s shortcodes and Global shortcodes.

 

how-to-exclude-shortcodes-3

 

Your website’s shortcodes: Specific shortcodes that belong to your project. These can be added, enabled, disabled, edited, and deleted by you.

Global shortcodes: Default shortcodes implemented for all projects in ICanLocalize. These can be disabled anytime for your project but cannot be edited or deleted.

Adding a new shortcode to your project

To add a new shortcode to your project, go to your website’s shortcodes section and click on New Shortcode.

 

how-to-exclude-shortcodes-4

 

The following dialog box will appear prompting you to enter the shortcode and choose its type.
Fill in the blanks with the shortcode information and click on the Save button.

 

how-to-exclude-shortcodes-5

 

  • Shortcode: Only enter the text inside the square brackets without the actual brackets.
  • Type of shortcode:
  • Atomic– A shortcode that does not require a closing shortcode, e.g., .
  • Open and close– A shortcode that requires a closing shortcode but the text between the two shortcodes is required to be translated, e.g., [message]This is important[/message].
  • Open, exclude, and close– A shortcode that requires a closing shortcode and the text between the two shortcodes is required to be excluded from the translation. For example, [code]SOME CODE EXAMPLE[/code].
  • Comment: Any comment that you wish to add to differentiate the shortcode from others or as a reminder.

Once your list of blocked shortcodes is fully set up, you are ready to send your content for translation from WPML. The shortcodes that are included and enabled in your list will not be counted in the word count; hence, you will not be charged for those shortcodes.

The system will also guarantee that any shortcodes that appear in the original text will be unchanged in the translation.

NOTE: Shortcodes must be set up in ICanLocalize before sending the content for translation from WPML. The system detects shortcodes in the text when the content is sent for translation. If the content is sent for translation and the list of “blocked shortcodes” is updated later, the content that was already sent will not be affected.

To learn more about how to exclude shortcodes, check this video tutorial: