how to make multi language site in wordpress - php

I wanted to make a wordpress website in 2 languages. English and Arabic. I wanted to make pages, categories and menus in 2 languages when user select English only English pages will shown to the user and when select Arabic only Arabic pages,categories and menus will be shown. ONLY Posts will remain the same for both. Every thing except posts will be changed user user.

You can do the following:
Get the the language pack (e.g. de_DE.mo) from wordpress.org. If the language pack isn't available as a standalone download, you could also use the .mo file which is bundled in the WordPress ZIP-file for your language. Located under wp-content/languages.
Move the .mo file to wp-content/languages/ of your default (english) WordPress installation.
Change the WPLANG constant in wp-config.php to the new locale (e.g. de_DE)
In your functions.php add the following filter:
functions.php
add_filter('locale', 'wpse27056_setLocale');
function wpse27056_setLocale($locale) {
if ( is_admin() ) {
return 'en_US';
}
return $locale;
}
Reference - https://wordpress.stackexchange.com/questions/27056/different-language-for-frontend-and-backend
Take a look at WordPress Codex - Translating WordPress
Additionally you can use WP plugins especially for translating your WP website:
Codestyling Localization
User Language Switch

Have a look about for a plugin that would do this for you.
I would say WPML plugin would be prefect for what you are trying to do, but this is a premium plugin and costs http://wpml.org .

hi M Usman Tahir i already work on 3 website that has multilangauge
follow the to see www.decidact.com
this website is in 5 language
1)download polylang plugind for your post content
2)downlaod codingstylelocalization for caption tranlsation

Related

Loco Translate not shows all translations

I am using Loco Translate to translate wordpress and woocommerce. Great plugin, but unfortunately some string translations are not visible/working on the frontend at the checkout page and cart. Could this be a child team problem?
Strings are know in Loco Translate and correctly translated, they are only not showing up at frontend.
Translation String issues:
Have a coupon? Click here to enter your code.
Flat rate:
Subscribe to our newsletter
Site www.narwal.shop/checkout
Help is appreciated.
Go to wp-content and uploads directory. create a new directory and name it as same as the plugin name. then create a new directory and name it languages.
now upload your .po and .mo files in it.
the problem is solved!
Force WP to load the language file from languages/loco/themes/.. directory, like this inside functions.php:
add_action ( 'wp', 'load_translations' );
function load_translations() {
load_theme_textdomain( 'theme-name-here' );
}
Update: you should contact the creator of the (child) theme.
Every single component that displays text (i.e.: almost all of them), including themes and plugins, need to have included multilingual support for it to work.
Woocommerce does it, but you might have other components that do not. If you have a custom theme, that would be the first thing I'd check.
Unfortunately, if this is the case there is nothing you can do about it other than not use it, accept that that part of the site will not be translated or ask the developer who made them to put in the extra work to add multilingual support.
See also: https://localise.biz/wordpress/plugin/child-themes
In my case it was a wordpress language problem. I resolved this by changing it from English to my target translation language. To achive this in your wordpress panel go to: Settings -> General -> find language and change it.

Wordpress theme with second language

I didn't find any learn for Multi-Lingual !
1.How to use function _e() ?
2.What's text_domain ? How can i set text_domain ?
e.g:
_e('Mine','text_domain')
in english returns "Mine"
in example language is "imja"
How to set "imja" ?
text_domain is a distinction inside WordPress that allows you to see which plugin or theme text comes from. The text domain can be any string that you want but as a best practice it should be a machine name of the theme or plugin you are building.
So if I had a plugin named MyPlugin I would translate text using any of the WordPress translation functions like:
print __("Translateable Text", "MyPlugin");
_e("Text that is translated then echoed", "MyPlugin");
For WordPress to render these strings in another language, in WordPress 4.0 and above, you can change the language at Settings > General > Site Language and your site will show the text in that language if available.
You will need language files for the language that you wish to change to, and if a plugin or theme doesn't offer a translation for your chosen language it will be rendered in the default language.
There are many tools and plugins for editing the .po/.mo files that hold the translations in WordPress. Some of those can be found in the WordPress translation handbook.

How to make a wordpress theme that supports only 1 .po file to support 2

i am trying to make my website support 2 languages that users can switch between them, i bought a theme that has a language directory with .po files such as en_US.po fr_FR.po and more. i copied the english file and translated it into Arabic, in order to apply the Arabic translation i have to rename the ar_EG.po to en_US.po which leaves me with 1 language option and i need to have both Arabic and English. Is there a way that i can make my website switch between 2 .PO files instead of 1 or can i make a new folder inside my word press installation with the same website but with the other language file working and both of the websites linked to the same database?
There are various plugins to manage multilanguage sites; I would personally recommend Polylang since it's free, very easy to use and makes a smart use of WordPress APIs so it's developer friendly, if you would need that. Also, every content gets its own URL, which it's good for SEO.
After installation, go into Settings → Languages to define the languages of your site. The plugin provides a widget that will enable your visitors to change the language of the site, as well as an special nav menu item.
You should keep the theme translation as ar_EG.po; the plugin and language switcher that comes with it will take care of loading the appropiate language file for the theme.
ya elipelavinz is right that plugins name is polylnag
if you want to tranlate your theme caption use codingstyleloalization
codingstylelocalization translate only __() caption or _e() function

Wordpress theme language

I have a site on wordpress using the subway theme, and most of the site is in Spanish, but I can't figure out how to change the language of the abbreviation of the months on "recent posts", I tried the wp-includes/locale.php that has those instructions to assign the abbreviations to the full word, but it doesn't change anything. What am I missing? or is it another file I have to change?
Dont touch the Core!
To localize plugins or themes, check out the Codex: http://codex.wordpress.org/I18n_for_WordPress_Developers

How to translate the post/page content of a theme

I am working on a site in which I have to give the option of 3 languages on the front page.
I searched a lot and was successful in translating the theme using .pot files but it is translating only the default strings of Wordpress.
I want to translate the post/page contents too which we are adding from wp-admin.
I don't want to do it with any Google translator or sidebar plugin. I want to offer this option in the index page.
Any help will be welcome.
Consider using i18n plugins such as qTranslate

Categories