WordPress.org

Forums

Unique
[resolved] Translation (po/mo) and loop-nav.php (7 posts)

  1. lic-8008
    Member
    Posted 1 year ago #

    Hi, fantastic theme! I just love it, clean and workable, great work.

    I am working on an Italian site, so I need it translated. I have mo/po files and everything is fine... EXCEPT for the loop nav 'Previous' & 'Next' posts.
    I checked the translations, and it's all there. But in the loop nav it still showed 'Previous' in English.
    I found the .php for this: loop-nav.php, translated it there, and now it's OK.

    But shouldn't it be handled by the language files instead?
    I'm worrying about updates changing that php file...
    My 'new' loop-nav.php is in the child theme, won't be overwritten, but what about the rest of the coding in that file? I just took the entire file and uploaded it in my child theme, after translating the 2 words.
    Thanks,
    Linda

  2. cybrjim
    Member
    Posted 1 year ago #

    Hi Linda.
    Somehow the translated file I wrote, is not loading. Can you help me with how to get the translated file to load?
    Thanks in advance.

  3. lic-8008
    Member
    Posted 1 year ago #

    hi cybrjim,
    the translations must be in the 'languages' folder. My Unique theme has one (translations of the theme Unique).
    Since I have a child-theme I have loaded the 'languages' folder there. In my child-theme files don't get overwritten during theme updates.

    does that help?

  4. cybrjim
    Member
    Posted 1 year ago #

    Hi.

    Thank you for the reply. My languages folder originally contained

    • unique-en_EN.mo
    • unique-en_EN.po

    I started translating it to Hungarian with poedit, altough the translation is partial I guess it should load anyways. So now I have the following files in my languages folder

    • unique-en_EN.mo
    • unique-en_EN.po
    • unique-hu_HU.mo
    • unique-hu_HU.po

    But the translation, is not loading because strings I've translated, remain unchanged. Each file has chmod 644 on them, so they are readable.

    Do I need to change something in the PHP code? Or do I have to rename the files to something else?

  5. lic-8008
    Member
    Posted 1 year ago #

    I am not an expert, but..
    first thing: did you change the language in config.php?
    example:
    define('WPLANG', 'hu_HU');

    then: did you check in poedit that 'a new translation' was created (ie: Hungarian) ?
    I have noticed that the procedure is different when creating a new translation, as opposed to just editing an existing. Check the poedit help files etc.

    In case, also put the languages in the original Unique theme (I have done so, just in case)

    So you'd have a languages folder in the unique theme with the Hungarian files AND a 'same' languages folder in the child-theme also.

    In my case, I actually had to take the loop-nav.php file and manually translate 'Previous' and 'Next' there. Only them did it come out right.
    That shouldn't have to be, but nevertheless, it finally worked.

    The other translations went through fine, though.

    Check config.php + if your Hungarian file is 'ok' and seen as a valid translation.

    Linda

  6. cybrjim
    Member
    Posted 1 year ago #

    Hi.

    Got it working. Somehow poedit didn't change the line "Language: us_US\n" to "Language: hu_HU\n". No wonder that my translation didn't load. Thank you for pointing me in the right direction.

  7. lic-8008
    Member
    Posted 1 year ago #

    great!

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic