Digital experiences for all disciplines
New Landing › How can we help? › Atelier › "Postcode/ZIP" is translated to Danish then revert back to English
New Landing › How can we help? › Atelier › "Postcode/ZIP" is translated to Danish then revert back to English
- This topic has 14 replies, 2 voices, and was last updated 9 years by
Mohammad – SUPPORT.
-
Posted in: Atelier
-
January 28, 2016 at 7:17 pm #244623
Hi, I would appreciate it a lot if you could check the checkout page of my website. Just try to buy something then go view the cart.
I’m using Danish for the language, so the field “Postcode/ZIP” should be translated as “Postnummer” or “Postnr.” However only that field stays in English. The weird thing is, when you refresh the page, for a brief moment you can see it translated to “Postnr.” but then when the page is loaded completely, it changes back to “Postcode/ZIP”. Can you tell me why is that??
The language file I modified is “woocommerce-da_DK.po” and I have compiled it to .mo file as well using poedit. Then I put those files in /languages/plugins/. There are no fuzzy translation. I’ll be waiting for your help again. Thank you very very much!!!
Regards,
FredJanuary 29, 2016 at 7:48 am #244701Hi,
Please paste this code at functions.php file:-function sf_text_strings( $translated_text, $text, $domain ) { switch ( $translated_text ) { case 'Postcode / Zip' : $translated_text = __( 'Postnummer', $domain ); break; } return $translated_text; } add_filter( 'gettext', 'sf_text_strings', 20, 3 );
Thanks
MohammadJanuary 29, 2016 at 8:31 am #244702Hi Mohammad,
Thanks for the code, but I need to say this. The website will use WPML in the future, add Norwegian and Swedish. If I use this code, will it fix this issue in the future when I switch the language? Thanks again.
– Fred
January 29, 2016 at 9:22 am #244719Hi,
If you use WPML then you ned to remove this code.
Thanks
MohammadJanuary 30, 2016 at 5:58 am #245006Hmm, I see. Alright then I will call you again when I have installed the WPML and deal with the issues later. Thanks, Mohammad.
– Fred
January 30, 2016 at 7:30 am #245013Hi,
We are always ready to provide best help & support.
Thanks
MohammadJanuary 30, 2016 at 8:08 am #245014By the way, Mohammad. That code you gave me is not working. Can you please give me another solution? Thanks.
– Fred
February 1, 2016 at 12:46 pm #245317Hi,
I have managed to resolve the issue so please check it now.
Thanks
MohammadFebruary 2, 2016 at 7:08 pm #245828Hi Mohammad,
You’re right! The issue is resolved now, thank you so much!!! What did you do, if I may know? Please explain it to me so I understand and hopefully won’t bother you with this same problem in the future 🙂 Thanks!
– Fred
February 3, 2016 at 5:16 am #245886Hi,
I just changed Postcode / Zip to Postcode / ZIP in my code to resolve the issue.
Thanks
MohammadFebruary 3, 2016 at 6:24 pm #246178Ah, thank you very much for the answer. I will consider it resolved for now. Please assist me again if another problem occurred in the future when I have installed WPML plugin. Thank you in advance, Mohammad.
– Fred
February 4, 2016 at 12:11 pm #246362Hi,
Dont worry. We are always ready to provide you best help and support.
Thanks
MohammadFebruary 19, 2016 at 2:40 am #250556Hi Mohammad,
I have installed the WPML plugin now and remove your code. The problem is back, can you help me again?
The strange thing is, it’s only for the Danish version of the website. If you switch to Swedish then it’s fine. I have made sure that the translation in the file “woocommerce-da_DK.po” is correct, but it’s still not working. I hope you can help me solve this issue. Thanks!
– Fred
February 19, 2016 at 6:45 am #250565Hi Mohammad,
Nevermind, I have figured it out by myself. The problem is, the original string in “woocommerce-da_DK.po” is “Postcode / Zip”, while in the Atelier theme, the string of ZIP is all uppercase “Postcode / ZIP”. Therefore the translation will never going to work. I have edited the original string and everything works perfect now. I will mark this thread resolved. Thanks!!
– Fred
February 19, 2016 at 6:58 am #250566Hi,
Please use this code at functions.php of child theme.function sf_text_strings( $translated_text, $text, $domain ) { if (($translated_text == 'Postcode / ZIP') && (ICL_LANGUAGE_CODE=='sv')) { $translated_text = __( 'Swedish', $domain ); // please change it }elseif(($translated_text == 'Postcode / ZIP') && (ICL_LANGUAGE_CODE=='da')){ $translated_text = __( 'Postnummer', $domain ); } return $translated_text; } add_filter( 'gettext', 'sf_text_strings', 20, 3 );
Thanks
Mohammad -
Posted in: Atelier
You must be logged in and have valid license to reply to this topic.