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

How to do translations in Wordpress?

programmeradmin1浏览0评论

I want my website to be in English and French, but I'm not sure how to make this happen. I have an excel spreadsheet with French translations for each English page in the site.

How to translations work? I would prefer to code it myself instead of using a plugin.

Thanks!

I want my website to be in English and French, but I'm not sure how to make this happen. I have an excel spreadsheet with French translations for each English page in the site.

How to translations work? I would prefer to code it myself instead of using a plugin.

Thanks!

Share Improve this question asked Aug 18, 2019 at 4:03 ellenellen 3451 gold badge5 silver badges16 bronze badges 3
  • 1 possible duplicate wordpress.stackexchange/a/222380/109616 – Makiomar Commented Aug 18, 2019 at 4:18
  • 1 also here wordpress.stackexchange/a/117612/109616 – Makiomar Commented Aug 18, 2019 at 4:20
  • Are you trying to translate a theme or the content of your website? – WSU Commented Aug 19, 2019 at 12:51
Add a comment  | 

1 Answer 1

Reset to default 0

I'd recommend you using Loco Translate plugin to create a translation. If you are creating a theme, you should specify the Text Domain and Domain Path in your style.css file.

/*
Theme Name: My Theme Name
Author: My Name
Author URI: http://sample.url
Description: Your theme description
Version: 1.0.0
Text Domain: mydomain
Domain Path: /lang
*/

Next, add some text in your theme.

<?php echo __( 'Hello there', 'mydomain' ); ?>

Then go to your wp-admin and you should find Hello there text and translate it to any languages you wish.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论