public function updateMainTranslation( $locale )
    {
        $trans = $this->translationByLocale( $locale );
        /** @var eZContentLanguage $language */
        $language = eZContentLanguage::fetchByLocale( $locale );
        if ( !$trans instanceof eZTagsKeyword || !$language instanceof eZContentLanguage )
            return false;

        $this->setAttribute( 'main_language_id', $language->attribute( 'id' ) );
        $keyword = $this->getKeyword( $locale );
        $this->setAttribute( 'keyword', $keyword );
        $this->store();

        $isAlwaysAvailable = $this->isAlwaysAvailable();
        foreach ( $this->getTranslations() as $translation )
        {
            if ( !$isAlwaysAvailable )
                $languageID = (int) $translation->attribute( 'language_id' ) & ~1;
            else
            {
                if ( $translation->attribute( 'locale' ) != $language->attribute( 'locale' ) )
                    $languageID = (int) $translation->attribute( 'language_id' ) & ~1;
                else
                    $languageID = (int) $translation->attribute( 'language_id' ) | 1;
            }

            $translation->setAttribute( 'language_id', $languageID );
            $translation->store();
        }

        return true;
    }
public function updateMainTranslation( $locale )
    {
        $trans = $this->translationByLocale( $locale );
        /** @var eZContentLanguage $language */
        $language = eZContentLanguage::fetchByLocale( $locale );
        if ( !$trans instanceof eZTagsKeyword || !$language instanceof eZContentLanguage )
            return false;

        $this->setAttribute( 'main_language_id', $language->attribute( 'id' ) );
        $keyword = $this->getKeyword( $locale );
        $this->setAttribute( 'keyword', $keyword );
        $this->store();

        $isAlwaysAvailable = $this->isAlwaysAvailable();
        foreach ( $this->getTranslations() as $translation )
        {
            if ( !$isAlwaysAvailable )
                $languageID = (int) $translation->attribute( 'language_id' ) & ~1;
            else
            {
                if ( $translation->attribute( 'locale' ) != $language->attribute( 'locale' ) )
                    $languageID = (int) $translation->attribute( 'language_id' ) & ~1;
                else
                    $languageID = (int) $translation->attribute( 'language_id' ) | 1;
            }

            $translation->setAttribute( 'language_id', $languageID );
            $translation->store();
        }

        return true;
    }
public function updateMainTranslation ( $ locale ) { $ trans = $ this -> translationByLocale ( $ locale ) ; /** @var eZContentLanguage $language */ $ language = eZContentLanguage :: fetchByLocale ( $ locale ) ; if ( ! $ trans instanceof eZTagsKeyword || ! $ language instanceof eZContentLanguage ) return false ; $ this -> setAttribute ( 'main_language_id' , $ language -> attribute ( 'id' ) ) ; $ keyword = $ this -> getKeyword ( $ locale ) ; $ this -> setAttribute ( 'keyword' , $ keyword ) ; $ this -> store ( ) ; $ isAlwaysAvailable = $ this -> isAlwaysAvailable ( ) ; foreach ( $ this -> getTranslations ( ) as $ translation ) { if ( ! $ isAlwaysAvailable ) $ languageID = ( int ) $ translation -> attribute ( 'language_id' ) & ~ 1 ; else { if ( $ translation -> attribute ( 'locale' ) != $ language -> attribute ( 'locale' ) ) $ languageID = ( int ) $ translation -> attribute ( 'language_id' ) & ~ 1 ; else $ languageID = ( int ) $ translation -> attribute ( 'language_id' ) | 1 ; } $ translation -> setAttribute ( 'language_id' , $ languageID ) ; $ translation -> store ( ) ; } return true ; }
Sets the main translation of the tag to provided locale

@param string $locale

@return bool
Sets the main translation of the tag to provided locale