Determine if a translation exists.

@param string $key
@param string $locale
@return bool
500601
public function has($key, $locale = null)
    {
        return $this->translator->has($this->fullkey($key));
    }
597828
public function translateOrFirst($locale = null)
    {
        $translation = $this->translate($locale, true);

        if ( ! $translation)
        {
            $translation = $this->translations->first();
        }

        return $translation;
    }
729693
public function hasTranslation($locale = null)
    {
        $locale = $locale ?: \localizer\locale()->id();

        foreach ($this->cachedTranslations() as $translation) {
            if ((int) $translation->getAttribute($this->getLocaleKey()) === (int) $locale) {
                return true;
            }
        }

        return false;
    }
463269
public function get(string $key, string $locale = null)
    {
        list($country) = $this->parseKey($key);

        $locale = $locale ?? $this->fallbackLocale;

        $this->load($locale);

        if ($this->has($locale, $country)) {
            return $this->loaded[$locale][$country];
        }

        return $key;
    }
906746
def exists?(key, _locale = nil, locale: _locale)
      locale ||= config.locale
      raise Disabled.new('exists?') if locale == false
      raise I18n::ArgumentError if key.is_a?(String) && key.empty?
      config.backend.exists?(locale, key)
    end
497693
public function stringExists($key) {
		
		// load translation strings
		$this->loadStrings();
		
		if (array_key_exists($key, $this->strings) or array_key_exists($key, $this->defaultStrings)) {
			return TRUE;
		} else {
			return FALSE;
		}
		
	}
504866
public static function has($key, $lang = null)
    {
        $lang = $lang ?: static::$lang;
        return isset(static::$langs[$lang][$key]);
    }
1006623
protected function getTranslationOrNew($locale)
    {
        if (($translation = $this->getTranslation($locale)) === null) {
            $translation = $this->createNewTranslation($locale);
        }

        return $translation;
    }
698667
public function isValidLocale($locale)
    {
        $locale = strtoupper($locale);
        if (substr_count($locale, '_')) {
            $locale = substr($locale, strpos($locale, '_') + 1);
        }

        if (substr_count($locale, '-')) {
            $locale = substr($locale, strpos($locale, '-') + 1);
        }

        return in_array($locale, $this->countryList);
    }
282594
protected function has(string $locale, string $country)
    {
        return isset($this->loaded[$locale][$country]);
    }
754631
protected function matchLocaleInAvailableLanguages($locale)
    {
        foreach ($this->availableLanguages as $language) {
            // browser accept language matches an available language
            if ($locale == $language['locale']) {
                return $language['locale'];
            }
            // first part of browser accept language matches an available language
            if (substr($locale, 0, 2) == substr($language['locale'], 0, 2)) {
                return $language['locale'];
            }
        }

        return false;
    }
389610
public function translate($key, $defaultValue = '', $locale = null) {
		return $this->translation->translate($key, $defaultValue, $locale);
	}
950111
public function addLocale(Locale $locale)
    {
        if (isset($this->localeCollection[(string)$locale])) {
            return false;
        }

        // We need to invalidate the parent's array as it could be inaccurate
        $this->localeParentCollection = [];

        $this->localeCollection[(string)$locale] = $locale;
        return true;
    }
722132
public function removeTranslation($locale, $domain, $key)
    {
        $unit = $this->findByDomainAndKey($domain, $key);
        $unit->deleteTranslation($locale);
        $this->persist($unit);
    }
379742
public function exists(string $key) : bool
    {
        $this->checkCallback();
        return isset($this->members[$key]);
    }
96376
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;
    }
1177312
public function validate($locale)
    {
        if (!$locale) {
            return false;
        }
        $lang = $this->langFromLocale($locale);
        $region = $this->countryFromLocale($locale);
        if (!$lang || !$region) {
            return false;
        }

        // Check the configurable whitelist
        $localeCode = strtolower($lang) . '_' . strtoupper($region);
        $locales = $this->getLocales();

        if (array_key_exists($localeCode, $locales)
            || array_key_exists(strtolower($localeCode), $locales)
        ) {
            return true;
        }

        // Fallback
        return strcasecmp($lang, $region)
            && strcasecmp($lang, $locale)
            && strcasecmp($region, $locale);
    }