• Resolved pandafoxxxx

    (@pandafoxxxx)


    Hello,

    I’m making my first big theme for wordpress and i’m still fairly new with php. I’m trying to make my theme in multiple languages and already tried the the following to do so:

    Setting the text domain in the style.css and adding <?php __('title', 'text-domain');?> in my pages. I added in my theme a language folder with the po files in the 2 languages that i’m using. en_US.po and nl_NL.po (With the mo files) I added the languages in qtranslatex and tried to switch languages. The website switches but the custom fields don’t. I tried to understand the integration guide but i’m getting stuck somewhere but I don’t know where? The wordpress wiki isn’t any help too sadly and there are barely any turorials online for this plugin. If somebody could help so I could understand what I am doing wrong, that would be amazing!

    https://www.ads-software.com/plugins/qtranslate-x/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author John Clause

    (@johnclause)

    You need to provide a better description how to reproduce the problem. I cannot understand how to try to reproduce. Besides, “Setting the text domain in the style.css” does not make sense to me. What do you mean there? “The website switches but the custom fields don’t” What do you mean here? front or admin side? which custom field, which page, again front or admin? Please, be specific, provide URLs, field names, page titles, etc.

    Please, choose one problem and describe exactly what people should do to observe the same thing as you do.

    In theory, FAQ and Integration Guide shold answer most of possible questions.

    Thread Starter pandafoxxxx

    (@pandafoxxxx)

    I’m gonna try to describe it better.

    Set my text-domain to customtheme in style.css

    /*
    Theme Name: Custom Theme
    <->
    Text Domain: customtheme

    My homepage (front-page.php):

    <header class="site-header">
        <h1><?php __('Welcome', 'customtheme'); ?></h1>
    </header>

    Created a po/mo file with the translation of ‘Welcome’ to Dutch and English and placed it inside wp-content/themes/customtheme/langauges.

    I’m new to this and the Integration guide is made for advanced wordpress/php users and beginners can’t make up anything from it. (Only understood from the integration guide “How to translate multilingual fields at frontend?”)

    Plugin Author John Clause

    (@johnclause)

    QTX does not deal with po/mo as it is mentioned in the description. For your po/mo to work the locales have to match.

    You do not need po/mo for English, en_US, that is the default from which all other are translated. File for en_US will be ignored, although I personally think that they should not ignored it, because sometimes one wants to phrase statements differently.

    But anyway, po/mo framework is documented in WordPress, starting from this doc: https://make.www.ads-software.com/polyglots/handbook/ I hope you can make sense of their documentation.

    How did you name the po/mo files, for example? It the examples I saw it should be “customtheme-nl_NL.po”. Is this how you named them?

    Thread Starter pandafoxxxx

    (@pandafoxxxx)

    exactly like that. I’m gonna try to make something out of the (terrible) wordpress docs. Thank you ??

    EDIT: For people who need some extra info, this page also helped me A LOT! https://developer.www.ads-software.com/themes/functionality/localization/

    Plugin Author John Clause

    (@johnclause)

    Last note, in order for QTX to switch language correctly the locales en_US and nl_NL must be entered in the language properties at pages /wp-admin/options-general.php?page=qtranslate-x&edit=xx in the field “Locale”. But before playing with qtx, make both locales work correctly without qtx, switching them at the bottom of the page /wp-admin/options-general.php.

    Thread Starter pandafoxxxx

    (@pandafoxxxx)

    Yeah all got that. Got it working now! It isn’t that hard afterall but the finding how to do it costs more time. WordPress needs a serious update on the docs. Thx for the help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Translating theme’ is closed to new replies.