Prepare Translatable Strings
This is how to make a string translatable in your theme or plugin:
$text = __( 'Hello World!', 'sample-theme' );
If you want to display the string to the page use:
_e( 'Hello World!', 'sample-theme' );
Get Translated Strings
$text = translate('Go multilingual with the Straker plugin.', 'sample-theme');
Using Conditional Statements with Locale
$locale = get_locale(); switch ($locale) { case 'en_US': get_template_part( 'default' ); break; case 'zh_CN': get_template_part( 'chinese_file' ); break; default: get_template_part( 'default' ); break; }
Working with Translated Page Links
function get_translation_link( $link ) { if ( class_exists( 'Straker_Translations' ) ) { $translated_link = straker_translation_link( $link ); return $translated_link; } else { return $link; } } get_translation_link('/translation-services/');
Text Widgets
By using Advanced Text Widget
Comments
0 comments
Article is closed for comments.