jcoppieters/cody

How could I add a third language to my website?

maufarinelli opened this issue · 3 comments

How could I add a third language to my website?
I didn't find anything about that

Thanks

/* add the language */
insert into languages values ('pt', 'Portuguese', 0);

/* add the pages */
create table xx as select * from pages where language = 'en';
update xx set language = 'pt';
insert into pages select * from xx;
drop table xx;

/* add the content */
create table xx as select * from content where language = 'en';
update xx set language = 'pt';
insert into pages select * from xx;
drop table xx;

and restart the application, should do the trick.

Amazing @jcoppieters

Just to help other that try that later. To add the content, I had to change the script to insert into content. Also, I had to change each id of the temporary table, otherwise 'ERROR: Duplicated Key 'KEY' for key 'PRIMARY'

So:
/* add the content _/
create table xx as select * from content where language = 'en';
update xx set language = 'pt';
insert into content select * from xx;
UPDATE xx SET id=id_10 WHERE language='fr'
drop table xx;

Hey Mauricio,

Thanks for the feedback.
I think:

update xx set id = 0;

Would probably solve the problem too, as the id in content is auto-increment.

Johan Coppieters, Brugge.

Sent from my iPad.

On Oct 8, 2016, at 5:23 PM, Mauricio Farinelli notifications@github.com wrote:

Amazing @jcoppieters

Just to help other that try that later. To add the content, I had to change the script to insert into content. Also, I had to change each id of the temporary table, otherwise 'ERROR: Duplicated Key 'KEY' for key 'PRIMARY'

So:
/* add the content /
create table xx as select * from content where language = 'en';
update xx set language = 'pt';
insert into content* select * from xx;
UPDATE xx SET id=id*10 WHERE language='fr'
drop table xx;


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.