Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instalation instruction for Noobs #6

Open
ghost opened this issue Sep 21, 2014 · 0 comments
Open

Instalation instruction for Noobs #6

ghost opened this issue Sep 21, 2014 · 0 comments

Comments

@ghost
Copy link

ghost commented Sep 21, 2014

Create dir:
TranslatableDataObject
_config.php => empty
TranslatableDataObject\code\TranslatableDataObject.php

Copy to server main dir not into mysite\code\ single file class

Otherwise class will be load before i18n and lang will be default en_us to all pages
__

Translatable::set_default_locale('en_US');
Translatable::set_allowed_locales(array('en_US', 'it_IT'));
SiteTree::add_extension('Translatable');

TranslatableDataObject::set_langs(array(
'IT',
'EN'
));

Don't try en_US', 'it_IT:

In Page.php add:

public function init() {
parent::init();
if($this->dataRecord->hasExtension('Translatable')) {
i18n::set_locale($this->dataRecord->Locale);
}
}

Finally:

foreach($this->getTranslationFields(null, "IT") as $field) {
        $f->addFieldToTab("Root.IT", $field);
    }

not

foreach($this->getTranslationFields(null, "it_IT") as $field) {
    $f->addFieldToTab("Root.IT", $field);
}

__

Its hard to be Silverstripe noob ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants