original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Sets the main translation of the tag to provided locale
  
  @param string $locale
  
  @return bool
docstring_tokens: Sets the main translation of the tag to provided locale