Title: How to switch language programatically
Last modified: April 26, 2017

---

# How to switch language programatically

 *  [swayam.tejwani](https://wordpress.org/support/users/swayamtejwani/)
 * (@swayamtejwani)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/how-to-switch-language-programatically/)
 * Is there any way we can change locale programmatically using qtranslate function?
   Is there any function available for that ? I need to send woocommerce email in
   two langauge (within same email) means if any other language selected apart from
   english e.g french, we need to send email in french and english, if spanish then
   spanish and english. Is there any way we can achieve that ?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Picard](https://wordpress.org/support/users/piotrku/)
 * (@piotrku)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/how-to-switch-language-programatically/#post-9088526)
 * None I know of, unless you modify the plugin files itself:
 * file: qtranslate_utils.php
    add function: function qtranxf_setLanguage($lang){
   global $q_config; $q_config[‘language’] = $lang; qtranxf_set_language_cookie(
   $lang); }
 * and then just: qtranxf_setLanguage(‘de’);
 *  Thread Starter [swayam.tejwani](https://wordpress.org/support/users/swayamtejwani/)
 * (@swayamtejwani)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/how-to-switch-language-programatically/#post-9095787)
 * Thank you piotrku, i will try this out, i think we can add this function to our
   theme functions.php, why to modify plugin file if its a stand alone function.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to switch language programatically’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/qtranslate-x_f9f9f9.svg)
 * [qTranslate X](https://wordpress.org/plugins/qtranslate-x/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/qtranslate-x/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/qtranslate-x/)
 * [Active Topics](https://wordpress.org/support/plugin/qtranslate-x/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/qtranslate-x/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/qtranslate-x/reviews/)

## Tags

 * [change](https://wordpress.org/support/topic-tag/change/)
 * [language](https://wordpress.org/support/topic-tag/language/)
 * [programmatically](https://wordpress.org/support/topic-tag/programmatically/)
 * [switch](https://wordpress.org/support/topic-tag/switch/)

 * 2 replies
 * 2 participants
 * Last reply from: [swayam.tejwani](https://wordpress.org/support/users/swayamtejwani/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/how-to-switch-language-programatically/#post-9095787)
 * Status: not resolved