Tag Info

Hot answers tagged

11

By far the best (easiest) way is to use the locale filter (inside get_locale()). First set up a quick function for retrieving a different language to use on the locale filter. /** * A function returns with returns the user's selectd locale, if stored. */ function wpse35622_get_new_locale($locale=false){ $new_locale = ...


9

There is a second argument in the __() function. It should be set to the domain you are are using for your plugin or theme. In the examples below I use 'text_domain'. Your domain string should be unique. It should not match any other domain string. Not using a text domain argument defaults to 'default' the WordPress domain name. See the link for more ...


7

I got it now , After searched many resources : function lang_support() { return array('en','fr'); // Add your support lang-code (1st place is a default) } function rewrite_lang(){ $langs = lang_support(); foreach($langs as $lang) { add_rewrite_endpoint($lang,EP_PERMALINK|EP_PAGES|EP_ROOT|EP_CATEGORIES); } } ...


4

Finally found it! If I understand your question right, the template is basically saved as metadata that needs to be updated. update_post_meta( $post_id, '_wp_page_template', 'your_custom_template' ); // or update_metadata('post_type', $post_id, '_wp_page_template', 'your_custom_template' ); Source and further info


3

You have to replace the call to BBpress’ language file. A good place to do this is a language specific file in your general languages directory. For Turkish it would probably be a file named tr_TR.php. This will be loaded automatically and only if it matches the language of your blog. It will not be overwritten. BBPress doesn’t use the function ...


3

Run a filter on get_pagenum_link and you should be able to do what you want. The next_posts_link / previous_posts_link functions each call functions that in turn call other functions, which eventually route back to the get_pagenum_link function which provides a filter by the same name. It should give you the control you need, though post a comment if you ...


3

I won't address the issue of variables in the string since it's already been said. You want to keep your string static, meaning that the content won't change. You also want to keep out unnecessary HTML. __( '<p>Hello World!</p>' ); __( '<h1>Hello World!</h1>' ); The above will take up two rows in your table for what is essentially ...


3

This will need to go in a plug-in, just put the following inside a file (login-languge.php) in wp-content/plugins/ /* Plugin Name: Log-in Language Plugin URI: http://wordpress.stackexchange.com/questions/72692/how-do-i-change-the-language-of-only-the-login-page Description: Changes the language for log-in/register screens only Author: Stephen ...


3

The translation strings not only get parsed during rendering (output on screen/in browser), but also by the GNU gettext parser. This one is not a PHP parser, so it can't fetch variables. This is the only part of a Theme or a Plugin, where you need to repeat yourself and add the plain string to every translation/gettext function call. // Wrong: __( 'External ...


3

I belive you can use a load_textdomain_mofile filter... add_filter('load_textdomain_mofile', 'custom_load_textdomain_mofile', 10, 2); function custom_load_textdomain_mofile( $mofile, $domain){ if ($domain == 'bp-ass') $mofile = 'somepath/to/your/mo/file.mo'; return $mofile; } Difference (comparing Otto) is you can actually specify your mo ...


2

Looking at the source load_plugin_textdomain takes three arguments: load_plugin_textdomain( $domain, $abs_rel_path = false, $plugin_rel_path = false ) It seems you are passing the absolute path to your language domain, as a relative path. Try: load_plugin_textdomain( 'myplugin', ABS_PATH_TO_LANGS_DIR);


2

Best way to do this is probably by using a second, custom-made, plugin. Make a new plugin directory. Call it something like "example-com-custom-langs" or something unique to your site. In there, make a php file with a plugin header describing what the plugin does (for your own sanity), and do something like this: ...


2

No, they were never there. The link you posted is for WordPress.com hosted blogs, not self-hosted WordPress.org software. Refer to Installing WordPress in Your Language for info on use in other languages.


2

You can make changes to the translation, yes, but it's not as simple as editing the text inside the fi.po file (or any PO file, for that matter). That's because WordPress actually uses another file, with an .MO extension, to render the translations. That extension is not meant to be read by humans, so you wouldn't be able to just open and translate it. It is ...


2

You can filter mu_dropdown_languages and re-add American English here. Sample code, not tested: add_filter( 'mu_dropdown_languages', function( $output, $lang_files, $current ) { array_unshift( $output, '<option value=""' . selected( $current, 'en_US', false ) . '>' . __( 'American English' ) . "</option>" ); ...


2

The problem was that I had changed the 'WP_CONTENT_DIR' directory, and Wordpress did not have writing permission to the new content folder, so it couldn't create the 'WP_CONTENT_DIR'/languages folder. After creating the languages folder in my new WP_CONTENT_DIR directory Wordpress did the language upgrade successfully.


2

Upload your danish language files (da_DK.mo and da_DK.po) in your wp-content/langauges/ folder on your webserver. Then edit the wp-config.php in your root folder This define ('WPLANG', ''); should be changed in define ('WPLANG', 'da_DK');


2

I don't know what the lang_id option is for. AFAIK it is not part of the core WordPress options. If you want to check the language of all blogs you could check the blog's own options table for WPLANG, or use the network's WPLANG option (or fail with a locale you need) in a similar way as WordPress' own get_locale() function. I'd recommend to check out ...


2

What you have to do is to create a simple plugin that will manage the text_domain of the installed plugins. If you don't want to have a global solution you can add the code to your functions.php in your theme. The idea is to instruct wordpress on where to find translations. Internally in all plugins this is done using something similar to ...


1

You may wanna try something like this : <?php $lang = qtrans_getLanguage(); if ($lang=="en") { echo 'ENGLISH TEXT HERE'; } else if ($lang=="fr") { echo 'FRENCH TEXT HERE'; } ?>


1

Thanks to the helpful tip from @t31os the issue can be fixed with the following code: /*************************************************************** * Function qtranslate_next_previous_fix * Ensure that the URL for next_posts_link & previous_posts_link work with qTranslate ***************************************************************/ ...


1

When date is retrieved from database WordPress passes it through date_i18n() function that draws your locale settings and translates date. You can filter its hook to override translated date with PHP default one in English. Try this: add_filter('date_i18n', 'eng_date', 10, 3); function eng_date($j, $req_format, $i) { return date($req_format, $i); } ...


1

I do this with the One Backend Language plugin. This way, the WPLANG language is only used in the frontend, and another used in the admin area. There are more plugins that do this, some allow you to choose a language per user. The downside is that you can still be logged in when you visit the frontend, and thus get the language of the admin area there too.


1

http://www.qianqin.de/qtranslate/ is what you need ... Edit I - after comment. First - thanks for all who contributed in the downvotes torrent. (this is what happens when one does not visit frequently enough :- ) ) now - The function that handles the switch is in qtranslate-core. (starts at line 80 more or less - depends on the version that you want.) ...


1

Yes. Language Switcher WordPress Plugin qTranslate WPML - the best, but commercial


1

Take a look at the files for the default Urdu theme to see what is necessary. WP Polyglots has some information too, the most important changes for 3.4 are listed on a dedicated page. I think the main point are the fonts: Don’t rely on the browsers capability to find the best font file, embed a Urdu font per @font-face{} instead.


1

I found a solution, realy dirty, but works. In the core.php file of the polylang plugin I found this stuff: // NOTE: I believe there are two ways for a plugin to force the WP language // as done by xili_language and here: load text domains and reinitialize wp_locale with the action 'wp' // as done by qtranslate: define the locale with the action ...


1

The WordPress locale depends on the WPLANG flag, this is found in your wp-config.php file, try to check there, that it's indeed set to Spanish. WordPress does not try to get the system locale in any way, and depends on either the WPLANG option or definition as stated above. However, there is a locale filter that can be hooked to by other plugins which can ...


1

Non-ASCII characters in URLs have to be encoded. Use rawurlencode() to do that. Example: a slug öüä has to be encoded as %C3%B6%C3%BC%C3%A4. You can still enter öüä into the address bar, the browser will send the encoded URL to the server. $_SERVER['REQUEST_URI'] will be 7%C3%B6%C3%BC%C3%A4, $_SERVER['REDIRECT_URL'] will be öüä. Do not edit WordPress ...



Only top voted, non community-wiki answers of a minimum length are eligible