1

I'm creating a WP website that is in Russian. This is my first website in any language other than English.

I'm trying to understand what modifications I need to do to make the website reads in Russian without issues. Note, I do NOT need to have WP Admin panel in Russian, English is OK there. Just want to ensure any parameters and charset values set correctly everywhere for the site to render cyrillic correctly everywhere.

I Googled the topic and searched Codex. I understand I need to specify correct LANG attribute for my HTML tag, which is set by <?php language_attributes(); ?>, which according to CODEX is located in wp-includes/general-template.php. I looked into the file and the areas pertaining to the language, etc. - are way above my head.

I also read this thread, advising to edit website's default language is through the wp-config.php.

QUESTION: 1) What is the best way to ensure LANG attribute is correctly specified for my WP website?

2) Are there any additional steps need to be taken (parameters specified, WP standard files modified, etc.) for a website to render all content correctly in Russian?

Thank you.

3

If it is a new install, the best option is to install WordPress in Russian. You will have English also available from "Settings > general > Site Language".

You can also manually install additional languages: download the files from this respository and upload theme to "wp-content/languages" directory. The new installed languages will be available in "Settings > general > Site Language".

When you set a languages via "Settings > general > Site Language" the language attributes will be auto generated by WordPress and you can use language_attributes() safely.

To ensure that all characters are correctly displayed, you should use UTF-8 enconding for all your files, including PHP files if you write russian directly there. Be sure that this files are saved in UTF-8 without BOM characters. You can do it easily with code editors like Notepad++.

For HTML you should set the charset meta to UTF-8 as soon as possible:

<head>
    <meta charset="UTF-8">

It can be done also via HTTP headers from your server, for example through .htaccess:

AddDefaultCharset UTF-8
  • 1
    and don't save code files with BOM.... – Mark Kaplun Jan 12 '15 at 9:00
  • Thank you so very much! This is exactly the Crash Course into creating of a non-English WP site I was hoping for. :) I'm going to give it a go over the next 2 days and if everything works out will mark the answer accordingly. Thanks again! – hanazair Jan 14 '15 at 20:40
  • @cybmeta - my code editor (TextWrangler) offers an option of saving a file as 'Unicode 8 with BOM' or 'Unicode 16 without BOM'. I know you said to save it as UTF-8 without BOM, but would saving it as "UTF 16 without BOM" also work? – hanazair Jan 26 '15 at 23:50
  • It should but I'm not sure about further implications it may have. You may find useful this question on StackOverflow – cybmeta Jan 27 '15 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.