WPML OVERRIDES COURSEPRESS PRO TRANSLATION

As per instructions found here on the forum, once I place .mo/.po in languages folder(...plugins/courspress/languages), I then need to go to General>Settings>Site Language and select which language I am working with. In this case I am working with the spanish translation for CoursePress Pro, so I've set this to Spanish. CHECK

RESULTS
Everything works as expected, I can see that Courspress Pro in the Dashboard has been translated and I can visit the front-end and see it to has been translated. This is the result needed except that the whole back-end(dashboard area) is now in spanish

NEXT(WPML)

I need the capability to translate posts/pages to spanish so I have purchased and installed WPML. During the setup I am asked to choose which languages I would like to use. I select English and Spanish. I complete the setup.

RESULTS
WMPL uses the first language I selected as its default(in this case English). This changes Courspress Pro translation front and back-end back to English. If I set the default here to Spanish, all works fine, but now I am unable to read the Dashboard/Wordpress at all as its in Spanish. Setting it back to English again I lose the translation for CoursePress Pro

FINAL THOUGHTS
Found that the .mo and .po translation files(cp-es_ES) for courspress works when placed in plugins>courspress>languages. However, when I install WMPL, WMPL's default setting overrides the courspress pro translation. I am not able to have Courspress Pro translated and have the back-end readable in english.

NOTES

If I dont have WPML activated i get the results I am looking for..almost. Because I have set the General>Settings>Site Language and select which language I am working with to spanish, the whole backend gets translated to spanish when all I need is courspress pro both front and back end to be translated.

  • Predrag Dubajic

    Hey @ME Admin,

    Hope you're doing well today :slight_smile:

    WordPress needs to be switched to the correct language based on translation file name, for example for Spanish your file will be named cp-es_ES, if you want to use different language only for CoursePress but keep the rest of admin section in English then you will need to name your files cp-default.po and cp-default.mo

    Also, try placing your translation files inside your wp-content/languages/plugins/ folder instead of languages folder inside plugin, this should do the trick.

    Let us know if it's working after this :slight_smile:

    Best regards,
    Predrag

  • ME Admin

    Hi Predrag,

    When you say wordpress needs to be switched to the correct language based on translation file name. Does that mean I should see cp-es_ES in the General>Settings>Site Language drop down? When I place cp-es_ES.mo and ep-es_ES.po in wp-content/languages cp-es_ES appears in the Site Language Drop down as a selection.

    You also said place the files in wp-content/languages/plugins instead of the languages folder inside the plugin. I dont have a wp-content/languages/plugins.. i only have wp-content/languages, as described above this is where I have place those files. Should I create a new folder under wp-content/languages so I have that path you described?

    The ultimate goal here is to have Coursepress Pro translated to spanish only on the front-end while the admin section stays in English. To get this to work would I rename cp-es_ES.mo > cp-default.mo and cp-es_ES.po > cp-default.mo and place these files inside the wp-content/languages folder?

    Also once this works.. would that mean that since its in spanish on the front-end I should be able to toggle the language switcher that WPML provides to get back to english on the front-end?

    Sorry for my confusion

  • Adam Czajczyk

    Hello ME Admin,

    I hope you're well today!

    I admin I'm still a bit confused on what exactly would you like to achieve here. Is that you'd like to keep CoursePress language settings "separate" from the rest of WP and at the same time use different languages for front- and back-end?

    Or is it just that you'd like to keep your entire front end in Spanish and entire back-end in English?

    The latter one should be doable with an additional snippet of code. To make it work first you need to make sure that both your front-end and back-end work well with selected languages. In your case I think both work well already in English so you only need to make sure that when you switch language to Spanish everything is properly translated (meaning that there are translation files for plugins and themes if necessary).

    If I understand correctly, that's already working as well so you may switch your entire site into English or Spanish and that's working fine. Am I right?

    The next step would be to add this code to the functions.php file of your current theme:

    add_filter('locale', 'wpse27056_setLocale');
    function wpse27056_setLocale($locale) {
        if ( is_admin() ) {
            return 'en_US';
        }
    
        return $locale;
    }

    This should set "fixed" back-end language to English, regardless of what you set in your site's language settings. Therefore you now should be able to switch site's language to Spanish and the setting should only affect front-end. Also, if there's any "language switcher" available on front-end, it should also affect front-end only.

    Will this do the trick for you?

    Best regards,
    Adam

  • ME Admin

    Hi Adam,

    Or is it just that you'd like to keep your entire front end in Spanish and entire back-end in English?

    Correct.

    The latter one should be doable with an additional snippet of code. To make it work first you need to make sure that both your front-end and back-end work well with selected languages. In your case I think both work well already in English so you only need to make sure that when you switch language to Spanish everything is properly translated (meaning that there are translation files for plugins and themes if necessary).

    If I understand correctly, that's already working as well so you may switch your entire site into English or Spanish and that's working fine. Am I right?

    Correct.

    This is what I am trying to see in spanish when language switcher is set to spanish..
    http://mindfulness-exercises.net/8-week-course/

    You nailed it. I'll try your solution and return with results.

  • ME Admin

    Ok so we are getting closer.

    Update to this point. If you visit here, you will see we have translated this page into Spanish, so when we use the language switcher, its doing what it supposed to do correctly.

    http://mindfulness-exercises.net/8-week-course/

    However, we still aren't seeing this in Spanish

    Course Dates: enero 28, 2016 - marzo 24, 2016
    Enrollment Dates: octubre 1, 2015 - enero 29, 2016
    Price:
    $369.00
    Enroll now
    Time: 7:00 PM Mountain Time

    And so you know, I have removed the cp-es_ES.mo/.po files from any languages folder as I was still not seeing the above translate. So hopefully we have a fresh start now as to what's next to get the above to translate.

    And yes the back end now stays in English regardless of the sites language.

  • ME Admin

    OK IT WORKED!!!

    So what I did is I removed those files out of the languages folder just so I know I had a fresh start. I then place the files back into the the coursepress languages folder only, then went to test and now I get..

    Fechas del curso: enero 28, 2016 - marzo 24, 2016
    Fechas de matriculación: octubre 1, 2015 - enero 29, 2016
    Precio:
    $369.00
    Inscríbase ahora
    Time: 7:00 PM Mountain Time <--- this is typed in directly to the page so I think if we put that in spanish we should get the right outcome

  • Adam Czajczyk

    Hello!

    I've visited the site and switched language back and forth between English and Spanish and the quoted part (as well as most of the rest of it) seems now to be properly translated (see screenshot), except the "Time" word.

    As this seems to be working fine now, I think we're now back to translation issue itself. It's worth noting that we provide our plugins "translation ready" but with English files only. All available translations are community-powered and in case of some plugins/languages translations may not be complete. Spanish translation seems to be complete but clearly there are still issues.

    That said I'd like to ask you if you could review CoursePress on your site in Spanish and share all un-translated text with me here. I'd then compare plugin code and translation files against them and if necessary asked CP developers to update translation files so translations for these text could be added.

    Thanks for your help!

    Best regards,
    Adam

  • ME Admin

    Thank you so much Adam!

    While I've got your ear.. how do I style that enroll button? And when I click Enroll it takes me into MarketPress, this is the next challenge to get the whole cart to translate.. placed the spanish Marketpress .mo/.po files into marketpress languages folder, but if I recall right only so much of Marketpress has been translated to spanish by the community, so I just get partial translation, maybe there's nothing else to do here at this time.

  • Adam Czajczyk

    Hello ME Admin,

    Could you please start a separate threads for these issues? We'd better avoid "mixing" issues in a single thread as this makes the entire thread complex and over time it often becomes too "messy" to follow up and provide proper help.

    I'd highly appreciate putting those issues into other, dedicated thread and hopefully I'll be able to help you with these!

    Best regards,
    Adam

  • ME Admin

    I think the "Time" translation is on us.. because this is what we have in our actual wordpress page in the editor

    [course_list]
    Time: 7:00 PM Mountain Time

    Im not sure why we have it setup like that, maybe we are not aware of how to get the time to appear without typing it in, possible its a short code we are not aware that displays it for us, instead of typing it

    And currently what your screen shot shows.. this is the only piece of coursepress we are using right there.. but now I need to run a test and see after I purchase, what the dashboard looks like to students as well as units, etc.,