Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Po Language files in child theme
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Po Language files in child theme
- This topic has 13 replies, 5 voices, and was last updated 10 years by Mohammad – SUPPORT.
-
Posted in: Neighborhood
-
December 5, 2013 at 5:50 pm #35567
Hi
I just finished translating my po file from english to danish, but can’t figure out, how to activate them in my Neighborhood CHILD Theme.I have created a “language” folder in the child theme, where I uploaded the po and mo files.
After that I have created a functions.php file in the child theme and added this code:<?php
add_action( ‘after_setup_theme’, ‘neighborhood_child_setup’ );
function neighborhood_child_setup() {/* Load the child theme’s gettext file */
load_child_theme_textdomain( ‘neighborhood’, get_stylesheet_directory() . ‘/languages’ );}
?>
But it doesn’t work. Please help.
Best regards, Michael
December 10, 2013 at 1:43 pm #36241I’ll ask another support staff about that. Cheers
December 11, 2013 at 11:06 pm #36621Hi,
neighborhood is not the text domain, try this text domain “swiftframework”
like this..
load_child_theme_textdomain( ‘swiftframework’, get_stylesheet_directory() . ‘/languages’ );
Let me know, what you got.
Thanks,
laranz.December 12, 2013 at 8:01 pm #36861Thanks Laranz, but no luck…
This is where I put my functions.php file:
/public_html/wp-content/themes/neighborhood-child
…and the code now looks like this:<?php
add_action( ‘after_setup_theme’, ‘neighborhood_child_setup’ );
function neighborhood_child_setup() {
/* Load the child theme’s gettext file */
load_child_theme_textdomain( ‘swiftframework’, get_stylesheet_directory() . ‘/languages’ );
}
?>My wp-config.php is in this directory:
/public_html
…and it looks like this in the language section of the code (I want it to be “da_dk”)/**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to wp-content/languages. For example, install
* de.mo to wp-content/languages and set WPLANG to ‘de’ to enable German
* language support.
*/
define (‘WPLANG’, ‘da_DK’);
define (‘WPLANG’, ‘ll_CC’);
define (‘FS_METHOD’, ‘direct’);
define(‘WP_DEBUG’, false);
/* That’s all, stop editing! Happy blogging. */I have also attached my translated PO file, which is located in:
/public_html/wp-content/themes/neighborhood-child/languagesPlease advise.
Best regards
MichaelDecember 14, 2013 at 10:56 pm #37141Hi,
I think, why it didn’t take the da_dk is because of this..
define (‘WPLANG’, ‘da_DK’); define (‘WPLANG’, ‘ll_CC’);
you change that language to ll_CC on the next line?
Let me know, what you got.
Thanks,
laranz.December 15, 2013 at 9:03 am #37155Hi, I didn’t put the “ll_CC” there in the first place. Don’t know how it got there?!?
I tried to change it to:
define (‘WPLANG’, ‘da_DK’);
define (‘WPLANG’, ‘da_DK’);
….no luckAnd afterwards:
define (‘WPLANG’, ‘da_DK’);
…also no luckSom of the words is translated and others are not. It seems it would have something to do with Woocommerce vs Neighborhood, maybe? (see attached file).
Michael
December 15, 2013 at 8:51 pm #37251Hi,
I don’t know how it goes there 😀 maybe you use any plugin to translate? or else no one would add that except you 🙂
So it now works, most of the words work and some of theme not. So make sure you translate all words in the .po file, download the latest theme, and find that .po file for the latest language file, and fill those.
For translating woocommerce try this: http://docs.woothemes.com/document/woocommerce-localization/
Let me know, what you got.
Thanks,
laranz.December 16, 2013 at 9:39 pm #37577Ok, so I previously had Localization installed, but never made it work with danish translation.. this explains the define (‘WPLANG’, ‘ll_CC’);
In the Localization plugin under the Woocommerce translate section it says:(see attached file) – does it mean anything?
Michael
December 17, 2013 at 5:08 pm #37771Hi,
No, see the info they gave here: http://docs.woothemes.com/document/woocommerce-localization/ under Translating – Codestyling Localization section.
Important: You can ignore the message in codestyling which states “Loading problem: Author is using load_textdomainem instead of load_plugin_textdomain.” We use both methods to ensure maximum compatibility.
Let me know, what you got.
Thanks,
laranz.December 17, 2013 at 7:56 pm #37812Hi Laranz, thx for your patience.
I allready translated the PO file in the Neighborhood theme earlier. Now I put the PO+MO files in the:
/public_html/wp-content/themes/neighborhood/language &
/public_html/wp-content/themes/neighborhood-child/language…and it almost works. But I don’t know what will happen when I update the theme next time…. Anyway I have stored the files, so it’ll have to do for now.
BUT there are still some words which are not translated (see attached file). I think it relates to woocommerce, but when I open the PO or POT file in:
/public_html/wp-content/plugins/woocommerce/i18n/languages…the words from my attached file is not on the “list”
WHERE do I edit these words?
Michael
December 17, 2013 at 8:10 pm #37815Think I got it 🙂 (but still don’t know what will happen after update…)
Copied the translated PO and MO files (da_DK) to:
/public_html/wp-content/themes/neighborhood/language &
/public_html/wp-content/themes/neighborhood-child/languageAnd reinstalled Localization – went to Localization plugin/woocommerce and pressed EDIT. All the words where translated to danish.
After this it worked 🙂Thx
December 17, 2013 at 9:47 pm #37835Hi,
Actually if you have this,
<?php add_action( ‘after_setup_theme’, ‘neighborhood_child_setup’ ); function neighborhood_child_setup() { /* Load the child theme’s gettext file */ load_child_theme_textdomain( ‘swiftframework’, get_stylesheet_directory() . ‘/languages’ ); } ?>
and your child theme is activated, this is enough /public_html/wp-content/themes/neighborhood-child/language no need to put the languages in /public_html/wp-content/themes/neighborhood/language
it didn’t work when you don’t put anything in /public_html/wp-content/themes/neighborhood/language folder? if so make sure the child theme is enabled.
Let me know, what you got.
Thanks,
laranz.September 10, 2014 at 10:38 am #109023Watch out the (correct) apostrophes and folder name (where the languages being located): »languages« (WordPress tutorial) and »language« (Neighborhood Theme). This works for me!
<?php
function neighborhood_child_setup() {
load_child_theme_textdomain( 'swiftframework', get_stylesheet_directory() . '/language' );
}
add_action( 'after_setup_theme', 'neighborhood_child_setup' );
?>
September 10, 2014 at 11:28 am #109051Hi,
I’m glad that issue resolved.
Thanks 🙂
With Best Regards
Mohammad -
Posted in: Neighborhood
You must be logged in and have valid license to reply to this topic.