Home / Forums / DynamiX Support / Codestyling Localization / DynamiX (Child theme) [temporary solution]

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts

  • keyhanjun
    Participant

    Hi Andy,

     

    just realised that when I activate the DynamiX Child Theme the plugin called “Codestyling Localization” only recognises the normal DynamiX theme (not the child theme) but the status of the normal theme is “deactivated”.

     

    So I can not translate anything.

     

    When I activate the normal Dynamix theme (not the child theme) everything is fine.

     

    So do you know any solution to use “Codestyling Localization” with the activated Child theme of Dynamix except to switch the themes every time before I want to use “Codestyling Localization”?

     

    Thanks. πŸ˜‰

    Andy
    Andy
    Keymaster

    Hi keyhanjun,

     

    Try copying the languages folder into the child theme and see if that works then?


    keyhanjun
    Participant

    Unfortunately it does not work this way. This way still only the normal theme is recognised but deactivated.

     

    Edit:

     

    After copying the translation folder into the ‘DynamiX-Child’ folder

    now I copied the following code from the function.php of the normal theme into the function.php of the child theme:

     

    /***************************************************************/

    /* Make DynamiX available for translation */

    /***************************************************************/

     

    // Load languages directory for translation

    load_theme_textdomain( ‘DynamiX’, CWZ_DIR . ‘/languages’ );

     

    $locale = get_locale();

    $locale_file = CWZ_DIR . “/languages/$locale.php”;

    if ( is_readable( $locale_file ) )

    require_once( $locale_file );

     

    /***************************************************************/

    /* Make DynamiX available for translation *END* */

    /***************************************************************/

     

    Codestyling Localization now finally recognises the child theme (as active!) but then if I translate something via the CL plugin nothing changes in the frontend. But then (after translation) if I copy all files from DynamiX-Child/translations back into DynamiX/translations the changes I made becomes visible on the frontend.

     

    So getting closer but still not perfect… πŸ˜‰

     

    So in summary:

    Although the child theme is active still only the language folder of the main theme (DynamiX/translation) is responsible for the output of the translation on the frontpage although now the edits made via the CL plugin are located in the language folder of child theme (DynamiX-Child/translations).

     

    Or in other words:

     

    http://www.youtube.com/watch?v=qe9KaCy_jGE&feature=related

     

    πŸ˜›

    Andy
    Andy
    Keymaster

    Hi keyhanjun,

     

    I’ll take a look at this when I’m back next week. πŸ™‚

     


    keyhanjun
    Participant

    Hi Andy,

     

    any news on a solution? The problem still exists.


    keyhanjun
    Participant

    Just tested your following solution 5 minutes ago:

    Copy the languages folder from the core theme to the child theme directory, followed by adding the following to DynamiX-Child/functions.php

     

    function my_child_theme_setup() {

    load_child_theme_textdomain( ‘NorthVantage’, get_stylesheet_directory() . ‘/languages’ );

    }

    add_action( ‘after_setup_theme’, ‘my_child_theme_setup’ );

    ?>

     

    But the problem is the same:

    When I edit something via Codestyling (on the Child-Theme) the edit gets not recognised.
    So after every edit I would have to copy the language folder from the child theme into the main theme.
    After doing this it works but is not really convenient.

     

    Any other ideas?

     

    Thanks. πŸ˜‰

    Andy
    Andy
    Keymaster

    Hi Keyhanjun,

     

    Did you see my other post then? I forgot to post that here too, but it looks like it doesn’t work anyway.

     

    I need to spend some time on this, unfortunately I have so little time at the moment, I’ll hopefully be able to next week.


    keyhanjun
    Participant

    Found a temporary solution:

     

    1. open the functions.php (wp-content/themes/DynamiX -> parent theme)

     

    change from:

    /***************************************************************/
    /* Make DynamiX available for translation */
    /***************************************************************/

    // Load languages directory for translation
    load_theme_textdomain( 'DynamiX', CWZ_DIR . '/languages' );

    $locale = get_locale();
    $locale_file = CWZ_DIR . "/languages/$locale.php";
    if ( is_readable( $locale_file ) )
    require_once( $locale_file );

    /***************************************************************/
    /* Make DynamiX available for translation *END* */
    /***************************************************************/

    to:

    /***************************************************************/
    /* Make DynamiX available for translation */
    /***************************************************************/

    // Load languages directory for translation
    load_child_theme_textdomain( 'DynamiX', get_stylesheet_directory() . '/languages' );

    $locale = get_locale();
    $locale_file = CWZ_DIR . "/languages/$locale.php";
    if ( is_readable( $locale_file ) )
    require_once( $locale_file );

    /***************************************************************/
    /* Make DynamiX available for translation *END* */
    /***************************************************************/

    2. open the functions.php (wp-content/themes/DynamiX-Child -> child theme)

    should look like this:

     

    <?php

    /**

    * DynamiX Child Theme Functions

    * Load languages directory for translation

    */

     

    function my_child_theme_setup() {

    load_child_theme_textdomain( ‘NorthVantage’, get_stylesheet_directory() . ‘/languages’);

    }

    add_action( ‘after_setup_theme’, ‘my_child_theme_setup’ );

    ?>

     

    3. copy the languages folder into the child theme

     

    PS: Andy hope you will find a better solution which will fit for both scenarios (child theme users / parent theme users) so that we do not loose the change after the next update of DynamiX which will obvious overwrite this change of the functions.php file of the parent theme.

     

    Hope this helps. πŸ˜‰

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.