10389 Posts in 2200 Topics by 1712 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 460 Views |
-
Translatable - default locale change of existing content

10 February 2012 at 6:41am Last edited: 11 February 2012 4:40am
Hi,
I hope it is not for the 113th time someone asking this - I am experiencing some problems after applying translatable - sure I have ignored this - yes I am stupidImportant: If the "default language" of your site is not english (en_US), please ensure to set the appropriate default language for your content before building the database with Translatable enabled.
The existing content was en_US, I have added other 2 (cs_CZ, and en_GB) which are the ones I want on the site. I have changed the _config.php and rebuild.
EDIT: Is there a way to revert to the original status quo - to rebuild the database with the correct default locale (cs_CZ instead of en_US)?
Thank you very much -
Re: Translatable - default locale change of existing content

11 February 2012 at 6:07am
Hi jend, welcome to the forums
No, I'm afraid there really is no turning back - unless someone has written a script for it..?
To make sure we uderstand correctly what you now have: you say you added other 2. Do you mean you now have a master en_US website and two other websiteversions en_GB and cs_CZ?
Or do you just have a cs_CZ master that has the wrong Locale (en_US) attached to it?
-
Re: Translatable - default locale change of existing content

11 February 2012 at 6:37am Last edited: 11 February 2012 6:43am
Hi Martimiz,
Exactly - I have a en_US master (with czech content in it) and two other versions (cs_CZ and en_GB) as a result of aplying translatable extensions (without changing the default from en_US -> cs_CZ first).
I have tried to clean the db (modifying/deleting the locale fields and records - SiteTree, SiteConfig + translationgroups) but could not get rid of the en_US - it pops up from somewhere always.
The desired result is a cs_CZ master with current (en_US) content and empty en_GB language version. -
Re: Translatable - default locale change of existing content

12 February 2012 at 12:40am Last edited: 12 February 2012 12:43am
It 'pops up from somewhere'... But where does it popup? Do the Locale fields get rewritten as en_US?
I don't suppose you would want to revert back to a mySQL dump from before enabling Translatable?
Anyway, if you want to use the original en_US site to become the default cs_CZ site I would start by doing something like this:
- do a database dump
- remove all existing pages/other stuff from the extra cs_CZ translation in the cms, if you're not going to use it.
- leave the en_GB translations as they are
- leave the translation groups as they are// Set the site locale (just in case)
i18n::set_locale('cs_CZ');// set the default language for a multilingual site
Translatable::set_default_locale('cs_CZ');- empty the Locale fields in the database (something like: update xxx set Locale = '' where Locale='en_US') for:
SiteTree
SiteTree_Live
SiteTree_versions
SiteConfig
(And any other dataobjects you made translatable)- do a /dev/build/?flush=1
- check the Locale fields, they should now be cs_CZ.
- check back here with the results
One more thing - once you get things running, don't forget this:
public function init() {
parent::init();
if($this->dataRecord->hasExtension('Translatable')) {
i18n::set_locale($this->dataRecord->Locale);
}
...
}_
-
Re: Translatable - default locale change of existing content

12 February 2012 at 1:48am Last edited: 12 February 2012 1:52am
Hi Martimiz,
thanks a lot -
yes I was thinking of using a backup, but finally found out exactly the same procedure (except for the final init) as you are describing below.
The problem with the en_US was a mistyping in a Translatable::set_default_locale directive - sorry to bother you.
Thank you very much
| 460 Views | ||
|
Page:
1
|
Go to Top |

