0

I know how to translate content in WordPress when they are specified in PHP files using .mo and .po files with Poedit for example. But the content in WordPress pages are saved in the MySQL database, so it seems to me that this approach is impossible. Is there a way to do this without using any third-party plugins?

To me the main problem seems to be that there is no way to extract the translation strings because they are in the database and not in a PHP file.

samurdhilbk
  • 419
  • 1
  • 5
  • 16
  • No, translation of post contents is made via translation plugins, creating alternative content for different languages (no po-mo files involved). – yivi Mar 15 '17 at 14:20

2 Answers2

0

Is there a way to do this without using any third-party plugins?

Within a single site, there is not.

WordPress has no native support for multi-language post content, and no way to switch between languages on the same site to display different versions of posts. That functionality will require a plugin.

There is a way to do it without plugins, but it essentially means duplicating all your content across multiple sites, using Multisite.

For example, you may define www.example.com to be in English, but add a site at es.example.com (or example.com/es) and set that site's language to Spanish. You would then have to recreate all your English posts in the second site and write them again in Spanish.

There are many drawbacks to this method, such as there being no fallback to English when a post is not translated, but it will give you a multi-language site without plugins.

Tim
  • 8,036
  • 2
  • 36
  • 52
-1

Maybe is possible to export all string with a REGEX in MySql (read this discussion about this).

Keep in mind that the most string are in prefix_posts and prefix_postmeta table. After you can try to create file .mo and .po, but i not try this.

Community
  • 1
  • 1
ClodClod91
  • 304
  • 1
  • 8