WPML’s tables
Language information and translations
WPML holds the language information in a separate table.
The table that holds the language and translation information is called icl_translations.
Each item (post, page, tag, category or comment) in the site needs to have an entry in this table. The entry specified the item’s language and the translation group it belongs to. Items that belong to the same translation group are translations of one another.
It has the following rows:
- translation_id – serial number
- element_type – the type of the element
- element_id – the ID of the item
- trid – the ID of the translation group
- language_code – language code of the item
- source_language_code – if translated, the language of the original item
For example, if we have an English post with ID=3, that is translated to Spanish and the Spanish translation has ID=7, the icl_translations table will look like this:
| translation_id | element_type | element_id | trid | language_code | source_language_code |
|---|---|---|---|---|---|
| 1 | post | 3 | 2 | en | |
| 2 | post | 7 | 2 | es | en |
* Because the two entries have the same value for trid, they are translations of one another. The value itself is not important.
Country flags
WPML ships with a large collection of country flags. It’s a well known fact that associating languages with countries is problematic. Many languages are spoken (sometimes differently) in different countries. However, country flags are still a helpful visual cue and help visitor spot their language easily.
WPML’s country flags are stored in the res/flags directory and the icl_flags table indicates which flag to return for each country. The columns of the icl_flags table are:
- id – serial number
- lang_code – the language code
- flag – the name of the flag file
- from_template – “0″: take the flag from WPML’s res/flags folder, “1″: take the flag from the theme directory
If you want to use a different flag from WPML’s flags collection, change the flag column in the table. If you want to supply alternative language flags, change both the flag and from_template columns to indicate the flag name from your theme directory.
You should put your own flags in a special directory in your theme. Under the theme directory, create images/flags and store the flag files there. For example:
THEMEDIRECTORY/images/flags/myflag.png
Don’t overwrite the files in the plugin directory. Your changes will be lost every time WPML is updated.
String translation
Most WordPress sites include some strings that don’t belong to any item (post, page, tag, category), which still need to be translated – for example, the blog’s tagline.
WPML includes a mechanism, we called String Translation, to handle these strings.
The strings are kept in the icl_strings table with the following columns:
- id – serial number
- language – language
- context – context (indicates what the string belongs to)
- name – name of the string
- value – the strings value (its contents)
- status – translation status indicating if the string is fully translated to all languages
Translations to the string are kept in the icl_string_translations table:
- id – serial number
- string_id – the ID (serial number) of the string being translated
- language – the language of the translation
- status – the status of the translation (complete / not complete)
- value – the translation itself
Viewing WPML’s tables
You can view the contents of WPML’s tables using the troublshoot page. To access it, go to WPML’s overview page, scroll down and click on Troubleshoot.
That page includes the contents of WPML’s tables in CSV (comma separated value) format. You can copy each of these entries and paste to a spreadsheet to view it in a nice table.
To best view the icl_translations table, you can sort the spreadsheet according to the trid column. This will list translations one after the other.
The troubleshoot page doesn’t allow writing to any of the tables. To do this, you should use a database editing tool such as PHPMyAdmin.
Now I know what element_id and trid fields are for. Very informative article! Thanks, Amir.
[...] http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query http://wpml.org/documentation/support/wpml-tables/ [...]
useful when, like the problem I have, you install the plugin, you activate it AND it doesn’t import/update icl_translations table with all the posts made before
Problem…
I change the icl_flags table for franch flag i put 1 in from_template but nothing change…
Solution?
To change the flags, go to WPML->Languages->Edit languages.
Hello!
I have a problem with uploading my own flags images.
I have 12 languages and when I upload a custom flag to every one of them and save. Eveything works fine.
But when I want to update some flag later, I upload a new one for one language and hit save, all other language’s flag setting is reseted back to “Use flag from WPML”.
I’m using the latest 2.6.0 version.
Can you post about it in our forum? Our support folks will be glad to help.
Hi. Help!
I don’t see the Troubleshoot page or any page that allows me to export the contents of WPML’s tables in CSV (comma separated value) format.
There is a Dump button but the file it creates has what looks like database scripts.
How can I extract the WPML tables into CSV?
Thanks!
We don’t have CSV output in WPML. We’re planning to create XML export and import, but this will take a while to complete.
Your article says
You can view the contents of WPML’s tables using the troublshoot page. To access it, go to WPML’s overview page, scroll down and click on Troubleshoot.
But I don’t see this anywhere. Only the Dump button but that isn’t CSV format.
Hi,
I would like to buy this plugin.But i am little bit clouded.Does this automatically changes the texts used inside the plugin. ie the words which are hard-coded. How this plugin fix those.
Sorry if its explained already.I couldn’t find those:(
Does this have a demo version?
Waiting for your reply.
Regards,
GinsB
WPML does not perform automated translation. It’s a tool that lets you translate your site yourself.
Hard-coded texts will only be translatable if they are wrapped in gettext calls. WPML hooks to GetText and lets you translate these texts using the String Translation module. For examples on how to use it, see here:
http://wpml.org/faq/language-setup/