Home » Documentation » Developers information » WPML compatibility packages

WPML compatibility packages

About WPML compatibility packages

Compatibility packages allow WPML to turn themes and plugins into multilingual.

Just like plugins extend WordPress and change its functionality, so do WPML’s compatibility packages work on themes and plugins. Compatibility packages turn themes and plugin into multilingual without editing them.

What compatibility packages can do

  • Add language switchers to themes.
  • Make navigation multilingual, so that all links go to pages in the correct language.
  • Create display options for language elements in WPML’s languages menu.
  • Make special theme features, such as featured posts, display contents in the right language.
  • Allow translating user-entered strings in themes and plugins.

Compatibility packages manual »

Every package needs to extend the base WPML package defined in the WPML_Package class. This class will have to be defined in a file called ‘load.php‘ that will reside in the root folder of the package.

The meta information that WPML will identify the package has to be placed in the first 8 Kbytes of the file load.php and has the following structure:

Continue reading

Compatibility package example »

This tutorial shows how to build a compatibility package for a WordPress theme. We’ll go through WPML’s compatibility package for ThemeHybrid, explaining how to make it fully multilingual without touching one line of the theme’s code.

Objectives – what we’re trying to implement

Multilingual themes have three important features:

  • Users can switch between languages.
  • All the page elements are displayed in the correct language.
  • All links go to contents in the correct language.

WPML’s compatibility packages implement all these basic features. In addition, compatibility packages also add configuration options, which users can use to customize language support in the theme.

Continue reading

Built-in compatibility packages »

Jump directly to...

WPML comes built-in with several compatibility packages for popular themes and plugins.

This means that those themes and plugins will run fully multilingual with WPML, without having to change anything.

Continue reading

WPML_Package class »

This class is declared in PLUGIN_FOLDER/inc/compatibility-packages/wpml-package.class. It’s an abstract class so it shouldn’t be instantiated but extended by the compatibility packages. Its main properties are:

  • $name – the name of package as given by the folder it sits in
  • $type – the type of the package (for built in packages this can be themes or plugins)
  • $settings – the package settings
  • $data – the package meta information as defined in the packages load.php file

These properties are set to each object that will be instantiated from a class that extends WPML_Package.

Continue reading

Leave a Reply

Please leave here comments about this page only.
For technical support and feature suggestions, head to our forum. We are waiting there!

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">