This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem:Can I use code or a SQL query to convert pt-pt to pt-be?

Solution:The best option here might be a workaround , as our developers will usually recommend against making that change with the database to avoid future issues.

Please go to WPML->languages->edit languages and add a new custom language

give the new language the desired code for "pt-br"

afterwards you can go to WPML Translation management dashboard and batch duplicate all your pages/posts to the newly created language for "pt-br" and once done either "hide" or remove the original language.

Relevant Documentation:

This topic contains 8 replies, has 2 voices.

Last updated by andrewM-36 12 months ago.

Assigned support staff: Bobby.

Author Posts
October 15, 2018 at 4:32 pm #2818295

andrewM-36

Hi. Client asked us to add Portuguese to the site so we’ve configured pt-pt and all the post content has been entered.

I’m a developer comfortable with coding WP plugins and themes. Is there a set of SQL queries or some WPML functions I can use to convert pt-pt posts, taxonomy terms and post meta to pt-br?

My spelling correction hit the title of this question: it should refer to pt-br of course and not pt-be.

Thanks.

October 17, 2018 at 12:02 am #2822562

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

The best option here might be a workaround , as our developers will usually recommend against making that change with the database to avoid future issues.

Please go to WPML->languages->edit languages and add a new custom language

give the new language the desired code for "pt-br"

afterwards you can go to WPML Translation management dashboard and batch duplicate all your pages/posts to the newly created language for "pt-br" and once done either "hide" or remove the original language.

let me know your results

October 17, 2018 at 8:56 am #2823840

andrewM-36

Thanks.

When I try to add a custom pt-br I get an error that the language code already exists. I did add pt-br previously to see if there was an easy way of moving the posts over, but removed it again.

Also I don't see where I would go to batch duplicate the posts. I'm using latest WP & WPML plugins, but we do have things set to translate manually (client choice) rather than using either the basic or advanced translation manager.

I understand your developers' standing advice completely but if they have some insight that would give me a path to quickly move posts from one language to another that really would be a great help.

Thanks again.

October 17, 2018 at 9:16 am #2823975

andrewM-36

I've tried to follow through the help you gave in https://wpml.org/forums/topic/change-pt-pt-to-pt-on-translated-website/#post-1455225 but of course with all the links obscured I can't see the screencast you showed 🙂

October 17, 2018 at 11:00 am #2824259

andrewM-36

So, I've added pt-br back to my list of languages and if I go to the list of posts in WP admin, viewing pt-pt posts then adding a pt-br post copies in the pt-pt content. That's great!

But, I can't see a way to add the pt-br posts in bulk. Is there a way? Or do we just need to go through adding them one by one?

Thanks.

October 17, 2018 at 5:00 pm #2825422

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

I have shared the screencast bellow, are you able to see it here ?

i was going to write out a step by step but i believe the screencast should be a good tutorial , if you are still experiencing issues please let me know

hidden link

October 18, 2018 at 10:53 am #2827687

andrewM-36

That worked perfectly, thanks.

One supplementary thing before I close the ticket. These new posts are all duplicates rather than translations. I followed the advice in https://wpml.org/forums/topic/bulk-converting-duplicate-in-translate-independently/ to set them all to translations. When I go into the edit-post screen, then the admin boxes all look fine but when I return to the Translation Manager these posts are all still listed as duplicates, not as translations.

Is the support article I refer to out-of-date or incorrect?

Thanks.

October 18, 2018 at 5:56 pm #2829148

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

When you enter the translated page do you see the option to click "translate independently" ?

you want to do this in a batch for all of them correct ?

unfortunately we do not have such function within WPML , and currently we cannot offer custom work within the forum , but there is an older thread posted by one of our developers that might help you.

Do note that the thread is quite old and i highly recommend testing this in either a dev environment or at least make sure to take a database and site backup

https://wpml.org/forums/topic/want-to-switch-all-translatons-to-translate-independently/#post-463480

October 22, 2018 at 8:58 am #2837356

andrewM-36

My issue is resolved now. Thank you!