Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #200387

    kriol
    Participant

    Hi,
    Thank you for an absolutely rocking theme πŸ™‚ The only thing that rocks even more are the knowledge base and these forums, I’ve solved and learned a lot by reading those πŸ™‚

    The web I’m working on: http://prufa.andartak.is/

    My problem: is making everything in the web in Icelandic. What I’ve done so far:

    1. Make a child theme

    2. Put the Icelandic language files in wp-content>languages and choose Icelandic in WP settings.

    3. Put this code in child theme’s functions.php:

    add_action( ‘after_setup_theme’, ‘my_child_theme_lang’ );
    function my_child_theme_lang() {
    load_child_theme_textdomain(‘x’, dirname(__FILE__) . ‘/x-child-integrity-light/framework/lang/’);
    }
    add_filter(‘x_option_x_integrity_portfolio_archive_sort_button_text’, ‘x_sort_translate’, 20);
    function x_sort_translate ( $string ) {
    return __( $string, ‘__x__’ );
    }

    4. Change to this in the config.php: define(‘WPLANG’, ‘is_IS’);

    5. Put default po and mo in the child theme’s Framework/Lang.

    6. Download /install Poedit change language strings in default.po and then upload the changed po and mo into child theme’s Lang folder. This does not seam to change anything πŸ™

    My best,
    Kris

    #200405

    kriol
    Participant

    Hi,
    I might be doing something wrong with Poedit. So feel free to ignore this request until and if I contact again.

    Best,
    Kris

    #200680

    Darshana
    Moderator

    Hi there,

    Thanks for writing in! Best way is to use a 3rd party plugin like WPML in case you don’t want to do it manually. The plugins will pickup the strings loaded from your language files.

    Let us know how it goes.

    #203444

    kriol
    Participant

    Hi and thanks for this tip.

    I was just thinking about this but was hesitating in getting a multi language plugin as I only need to translate a few sentences. The website is only going to be in one language, Icelandic.

    Would you still recommend WPML?

    #203784

    Paul R
    Moderator

    Hi,

    Upon checking your site, I can see it is already ni Icelandic language.

    Have you figured it out? Can you please confirm.

    Thanks

    #204257

    kriol
    Participant

    Hi and thank you,

    I put two filters in the child theme functions.php file to translate “Read more” and “Search” but the file I made in Poedit does not work. I checked on the file by downloading it and opening again in Poedit and my changes were there although they are not visible in the website.

    Best,
    Kris

    #205167

    kriol
    Participant

    Hi again,

    I have not figured it out.
    I still need to translate some language strings in the front end for example “Type and press “Enter” to search”.

    At the top here I describe what I did in regard to translating the site. Is it possible you can see from that what I did wrong?

    I really want to be able to translate language strings that are still in English, preferably without a plugin.

    I suspect this is probably not something you are supposed to help with but still hoping for some clue :-/

    Best,
    Kris

    #205177

    kriol
    Participant

    Yesss! Victory!

    I saw in some post here that .po and .mo should go in the parent theme’s lang folder but not in the child themes as I had done (and read somewhere) – now it’s working πŸ˜€

    #205187

    Rad
    Moderator

    Cool, good job! πŸ˜‰

    #208710

    kriol
    Participant

    Hi again.

    It wasn’t so cool after all. when I updated X the .po and .mo language files with all my strings were deleted πŸ™ They were in Framework > Lang (parent theme).

    I have put the files back but how can I tell WordPress to use the language files in the child theme? (or isn’t that the correct way??).
    You can see here at the top how I did this. In item 6 I forgot to mention that I renamed the .po and .mo is_IS.po and is_IS.mo instead of default.

    Migh the functions.php be wrong?

    Best,
    Kris

    #209001

    Rue Nel
    Moderator

    Hi Kris,

    The best way to have your language files in WordPress is to place the files in its own directory. On your site server, create a new folder in your /wp-content/ directory called /languages.The language directory might be present already since you are using Icelandic. Inside that languages folder, you will see is_IS.mo which is the translation files of WordPress into your language. You also need to create another folder ‘themes’. What you would probably do is to rename default.po to x-is_IS.po. If you already have your translation, is_IS.po and is_IS.mo files ready, you can rename it to x-is_IS.po and x-is_IS.mo and upload the files to the /wp-content/languages/themes/ folder you just created.

    By having it this way, your language translation files will not be overwritten when you do updates to WordPress, X themes and plugins you have translated.

    Note: If you have plugins that you’ve translated to your language, you can rename your translation files to plugin_name-is_IS.po and upload it to /wp-content/languages/plugins/.

    Please let me know if this works for you.

    #214964

    kriol
    Participant

    Thank you very much. This seems to be working fine.

    Kris

    #215103

    Zeshan
    Member

    You’re welcome! πŸ™‚

    #348832

    Ruben
    Participant

    Hi Staff,

    It would be super nice if I could get this to work as well!
    I’ve been reading many, many posts all day and nothing seems to work.
    (I’m trying to make the translation work from the child theme)

    The solution offered in this thread looked like it was THE answer to my challenge, …but still no luck.

    I’ve performed all necessary steps to direct to the child theme’s language files. Placing the files in the /language/themes folder didn’t do anything. Do I have to make extra adjustments to make this solution work?

    #348994

    Lely
    Moderator

    Hello Ruben,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.