- This topic has 4 replies, 2 voices, and was last updated 8 years, 7 months ago by Mahesh.
-
AuthorPosts
-
February 16, 2016 at 7:48 pm #85581MickeParticipant
Every time I get theme update the swedish language is gone, I tried to add a language folder to my childtheme folder but it don’t work. Is here anybody who can help me how to get the language from the childtheme folder?
February 17, 2016 at 9:51 am #85615MaheshParticipantHi @micke,
To load child theme’s translations files instead of parent theme, , add the following code in your child theme’s
functions.php
:// Load translation files from your child theme instead of the parent theme function my_child_theme_locale() { load_child_theme_textdomain( 'catch-kathmandu', get_stylesheet_directory() . '/languages' ); } add_action( 'after_setup_theme', 'my_child_theme_locale' );
Then add your translated files inside a “languages” folder in the child theme.
Regards,
MaheshFebruary 19, 2016 at 2:52 am #85754MickeParticipantShould there be <php? and ?> befora and after?
February 19, 2016 at 3:05 am #85757MickeParticipantIt worked, Thanks again for you help! The only thing was that I had to change this line: // Load translation files from your child theme instead of the parent theme
To this: /* Load translation files from your child theme instead of the parent theme*/
February 19, 2016 at 10:12 am #85787MaheshParticipantHi @micke,
I assume there is already a <?php tag at the beginning of functions.php file. If the has been closed with ?> tag then you’ll need to <?php again but if the previous tag is not closed you don’t need <?php tag. you can omit the ?> tag at the end if there is in the code thereafter.
In php // is used for single line comment and /* */ is for multiple line comment. You can remove the line, the comment is just to make us easy what that function does.
Anyway you’ve fixed the issue and make it working, that is great.
Have a nice day.Regards,
Mahesh -
AuthorPosts
- The topic ‘Languages’ is closed to new replies.