Title: Language override
Last modified: August 31, 2016

---

# Language override

 *  Resolved [etmanko](https://wordpress.org/support/users/etmanko/)
 * (@etmanko)
 * [10 years ago](https://wordpress.org/support/topic/language-override/)
 * Dear all,
 * sorry for this type of question but i have problem with translation woocommerce
   for some sentence in my language (Slovakia). Due to law in our country is needed
   to change text for one field. I used loco for translation fields what works perfect
   but my main problem is that after some time my translation is override somehow(
   i didn’t do any updaet update theme i don’t do anything just leave my whole web
   untouched) to original slovak translation, where my translated string are overriden.
   I already used your help page with translation:
 * // Code to be placed in functions.php of your theme or a custom plugin file.
   
   add_filter( ‘load_textdomain_mofile’, ‘load_custom_plugin_translation_file’, 
   10, 2 );
 * /*
    * Replace ‘textdomain’ with your plugin’s textdomain. e.g. ‘woocommerce’.*
   File to be named, for example, yourtranslationfile-en_GB.mo * File to be placed,
   for example, wp-content/lanaguages/textdomain/yourtranslationfile-en_GB.mo */
   function load_custom_plugin_translation_file( $mofile, $domain ) { if ( ‘textdomain’
   === $domain ) { $mofile = WP_LANG_DIR . ‘/textdomain/yourtranslationfile-‘ . 
   get_locale() . ‘.mo’; } return $mofile; }
 * but this unfortunatelly didn’t worked.
 * I tried to change permission of translated file to only read but was overrided
   again due to woocommerce was installed under server permission.
 * I really don’t know where problem could be and i really appreciate your helps
   or advice.
 * Many thanks
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/language-override/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/language-override/page/2/?output_format=md)

 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332874)
 * The code above has not been modified – did you change it to load a custom file
   or use what you pasted (which won’t work)?
 *  Thread Starter [etmanko](https://wordpress.org/support/users/etmanko/)
 * (@etmanko)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332942)
 * Hi Mike,
 * i replaced if ( ‘textdomain’ === $domain ) {
    to if ( ‘woocommerce’ === $domain){
   and $mofile = WP_LANG_DIR . ‘/textdomain/yourtranslationfile-‘ to $mofile = WP_LANG_DIR.‘/
   wp-content/languages/SK.po’ . get_locale() . ‘.mo’;
 * my translated language was saved in file SK.po and this will not working, translation
   was original in english.
 * Many thanks
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332949)
 * You need a mo file, not the po file. Also the name in your snippet was wrong.
   It is looking for :
 * SK.poSK.mo
 * in your case which is wrong 🙂
 *  Thread Starter [etmanko](https://wordpress.org/support/users/etmanko/)
 * (@etmanko)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332951)
 * I changed it to:
    /* * Replace ‘textdomain’ with your plugin’s textdomain. e.
   g. ‘woocommerce’. * File to be named, for example, yourtranslationfile-en_GB.
   mo * File to be placed, for example, wp-content/lanaguages/textdomain/yourtranslationfile-
   en_GB.mo */ function load_custom_plugin_translation_file( $mofile, $domain ) {
   if ( ‘woocommerce’ === $domain ) { $mofile = WP_LANG_DIR . ‘/wp-content/languages/
   sk_SK’ . get_locale() . ‘.mo’; } return $mofile; }
 * but still english translation.
 * in wp-content/languages/ i have file sk_SK.mo and sk_SK.po
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332952)
 * rename it to wc-sk_SK.mo, and change the sk_SK part in your snippet to wc-
 *  Thread Starter [etmanko](https://wordpress.org/support/users/etmanko/)
 * (@etmanko)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332953)
 * ouch i see the script that locale are dynamically selected.
    i changed my code
   to: $mofile = WP_LANG_DIR . ‘/wp-content/languages/wc-‘ . get_locale() . ‘.mo’;
 * file on ftp renamed to wc-sk_SK.mo but still same english language on page 🙁
   i really don’t understand. if i change url for static ‘/wp-content/languages/
   wc-sk_SK.mo’; still english language was used
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332954)
 * what does `echo get_locale();` give you? I wonder if the code is wrong.
 *  Thread Starter [etmanko](https://wordpress.org/support/users/etmanko/)
 * (@etmanko)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332964)
 * Hello,
 * i put your code into function.php and on the page is locale: sk_SK so it should
   be correct.
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332983)
 * Ok, so which strings are missing, or are not strings translated? What about the
   backend, is that translated?
 *  Thread Starter [etmanko](https://wordpress.org/support/users/etmanko/)
 * (@etmanko)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332984)
 * There is not missing string. In our country i need to change translation becouse
   some string are translatted incorrectly.
    for example backordered is translated
   as returned in my language in its tricky in checkout. In total i founded that
   4 strings are not correcnt and not aligned with our law, therefore i did translation
   using Loco and save it. This works some hours but from unexpected reason was 
   my translated file overriden with original woocommerce file translation where
   i have again incorrect translated strings.
 * I don’t know why filter not working but this make me sad as i did translation
   as last step in woocommerce configuration and as i am very beginer it take for
   me long time.
 * Any help how setup woocommerce to not override translated translation with original
   translation?
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332985)
 * Just the ‘load_custom_plugin_translation_file’ snippet method above which does
   work my end. It must be to do with the naming of the files – I cannot see what
   else it could be.
 * If there are not many strings to correct, how about using ‘say what’ instead?
 *  Thread Starter [etmanko](https://wordpress.org/support/users/etmanko/)
 * (@etmanko)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332994)
 * Sorry, what is ‘say what’?
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332995)
 * [https://docs.woothemes.com/document/woocommerce-localization/#translate-or-replace-default-text](https://docs.woothemes.com/document/woocommerce-localization/#translate-or-replace-default-text)
 *  Thread Starter [etmanko](https://wordpress.org/support/users/etmanko/)
 * (@etmanko)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7332999)
 * Mike,
 * super this is sufficient for me. I hope translation will not be overriden again.
   I translated 5 strings with ‘say what’
 * Many thanks for your time and support.
 *  [cokoliv](https://wordpress.org/support/users/cokoliv/)
 * (@cokoliv)
 * [10 years ago](https://wordpress.org/support/topic/language-override/#post-7333140)
 * Etmanko,
    please, what you write in the “Text domain”? I also solve unwanted 
   changes in Slovak translation module woocommerce. Thanks.

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/language-override/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/language-override/page/2/?output_format=md)

The topic ‘Language override’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [Localization](https://wordpress.org/support/topic-tag/localization/)
 * [loco](https://wordpress.org/support/topic-tag/loco/)

 * 16 replies
 * 3 participants
 * Last reply from: [etmanko](https://wordpress.org/support/users/etmanko/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/language-override/page/2/#post-7333141)
 * Status: resolved