This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Localization in a child theme

  • Creator
    Topic
  • #18104
    brainray
    Participant

    Hello,

    thanks to this post

    http://support.themeblvd.com/forums/topic/localization/

    I have been able to localize some strings of the Akita theme to the German language.
    I am using a child theme. Now I wonder, if the de_DE.po and the de_DE.mo files should be positioned in ‘themes/akita/lang’ folder or better in ‘themes/akita-child/lang’?

    Thanks in advance

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #18111
    Jason Bobich
    Keymaster

    Hello,

    Sure, you can do it from a child theme, but it’s going to take some additional work. You’d have to actually register this location for the theme.

    http://codex.wordpress.org/Function_Reference/load_theme_textdomain

    Also, you’d have to completely re-generate the PO files that I generated for you and included in the theme originally because now the absolute path to the localization files will be different. So, if you were to just copy the original files, they won’t work because the path on your server to this location is different.

    But are you just doing localization of some text strings on the frontend? This plugin will work great for that and cause a lot less headache.

    https://wordpress.org/plugins/theme-blvd-string-swap/

    If you’re worried about performance or overhead of the plugin, you can also just filter the text strings directly from your child theme’s functions.php. I organize all text strings outputted from the frontend of the site in one location so they can be easily filtered without having to go through the dreaded WP localization process.

    See here in the theme: /framework/includes/locals.php

    function my_frontend_locals( $locals ) {
    	$locals['string_1'] = 'Translation of string 1...';
    	$locals['string_2'] = 'Translation of string 2...';
    	$locals['string_3'] = 'Translation of string 3...';
    	$locals['string_4'] = 'Translation of string 4...';
    	return $locals;
    }
    add_filter( 'themeblvd_frontend_locals', 'my_frontend_locals' );
Viewing 1 replies (of 1 total)
  • The forum ‘Akita Responsive WordPress Theme’ is closed to new topics and replies.