Translate placeholder text in search field

Just as any regular string, you can use <?php esc_attr_e( ‘Your Search term here’, ‘your_theme_slug’ ); ?> So your code for the <input> would look like <input type=”search” class=”search-field” placeholder=”<?php esc_attr_e( ‘Your Search term here’, ‘your_theme_slug’ ); ?>” value=”<?php echo esc_attr( $search ); ?>” name=”s”> WPML, as well as WordPress, uses the PHP get_text() function. … Read more

Setting WPLANG from a plugin

In wp-includes/l10n.php you will find the function get_locale(). It offers a filter; you can set the language and ignore the constant: function get_locale() { global $locale; if ( isset( $locale ) ) return apply_filters( ‘locale’, $locale ); // WPLANG is defined in wp-config. if ( defined( ‘WPLANG’ ) ) $locale = WPLANG; // If multisite, … Read more

Having a two language website

Convert your site to a multisite, then … Create a second site. Set the site language to Persian in Options/General. Set the language of the first site to English. You can install a plugin to link translated posts like MultilingualPress (disclosure: I was the lead developer for that plugin for a long time). You can … Read more