最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

multi language - How to tell a theme to use different .mo and .po files?

programmeradmin2浏览0评论

I have a theme which loads .po and .mo files to display strings in English. I want to have only one language (Polish), but those two files are en_US. I tried replacing content in the en_US.po file but nothing changed on the website, I do not know why. Where does it store strings if changing .po files changes nothing?

I have a theme which loads .po and .mo files to display strings in English. I want to have only one language (Polish), but those two files are en_US. I tried replacing content in the en_US.po file but nothing changed on the website, I do not know why. Where does it store strings if changing .po files changes nothing?

Share Improve this question asked Mar 25, 2014 at 14:37 NakedCatNakedCat 1891 gold badge2 silver badges9 bronze badges 2
  • 2 Take a look at Translating Wordpress to get to know what you're dealing with. Besides that, you probably haven't generated the corresponding mo-file. Additionally you really shouldn't use the english translation file for the polish translation. – Nicolai Grossherr Commented Mar 25, 2014 at 14:41
  • 2 To further your reading, I did an answer a while ago. Go check it out wordpress.stackexchange/a/137727/31545 – Pieter Goosen Commented Mar 25, 2014 at 15:38
Add a comment  | 

3 Answers 3

Reset to default 3

There are already an en_US.po file in the theme you are using. You can simply make a copy of that file and rename it as pl_PL.po. You can now open the pl_PL.po template with poedit, do all your translations in there, and just save it. Poedit will automatically create a pl_PL.mo template.

No need to go through all the pt. Just remember, as previously stated, change the language in the wp-config.php to pl_PL

Hi to translate your website you can do the following:

  1. Define your language in wp-config.php : define('WPLANG', 'pl_PL');
  2. Then generate a po file for your theme with e.g this service: iCanLocalize Scanner
  3. Then your po and mo files should be named pl_PL.po and pl_PL.mo and put into a folder called languages or lang or something like this in your theme.
  4. if not, create a folder for languages and then use load_theme_textdomain (or load_child_theme_textdomain if it's a child theme)
  5. If there's already a language folder with po and mo files just put your new files in the same folder.

With this you should be able to easily translate your site.

EDIT: if there's a pot file in your theme folder use it directly to generate po and mo files.

Go to ADMIN Dashboard and than go to Settings -> General and select your language (Polish).

You can define by yourself the language via the wp-config.php file in you wordpress root directory: define('WPLANG', 'pl_PL');

发布评论

评论列表(0)

  1. 暂无评论