Checks if a message has a translation (it does not take into account
        the fallback mechanism).

        @rtype: bool
        @return: true if the message has a translation, false otherwise
425643
def defines(self, id, domain='messages'):
        
        assert isinstance(id, (str, unicode))
        assert isinstance(domain, (str, unicode))

        return id in self.messages.get(domain, {})
796383
def _get_translated_model(self, language_code=None, use_fallback=False, auto_create=False, meta=None):
        
        if self._parler_meta is None:
            raise ImproperlyConfigured("No translation is assigned to the current model!")
        if self._translations_cache is None:
            raise RuntimeError("Accessing translated fields before super.__init__() is not possible.")

        if not language_code:
            language_code = self._current_language
            if language_code is None:
                raise ValueError(get_null_language_error())

        if meta is None:
            meta = self._parler_meta.root  # work on base model by default

        local_cache = self._translations_cache[meta.model]

        # 1. fetch the object from the local cache
        try:
            object = local_cache[language_code]

            # If cached object indicates the language doesn't exist, need to query the fallback.
            if not is_missing(object):
                return object
        except KeyError:
            # 2. No cache, need to query
            # Check that this object already exists, would be pointless otherwise to check for a translation.
            if not self._state.adding and self.pk is not None:
                prefetch = self._get_prefetched_translations(meta=meta)
                if prefetch is not None:
                    # 2.1, use prefetched data
                    # If the object is not found in the prefetched data (which contains all translations),
                    # it's pointless to check for memcached (2.2) or perform a single query (2.3)
                    for object in prefetch:
                        if object.language_code == language_code:
                            local_cache[language_code] = object
                            _cache_translation(object)  # Store in memcached
                            return object
                else:
                    # 2.2, fetch from memcached
                    object = get_cached_translation(self, language_code, related_name=meta.rel_name, use_fallback=use_fallback)
                    if object is not None:
                        # Track in local cache
                        if object.language_code != language_code:
                            local_cache[language_code] = MISSING  # Set fallback marker
                        local_cache[object.language_code] = object
                        return object
                    elif is_missing(local_cache.get(language_code, None)):
                        # If get_cached_translation() explicitly set the "does not exist" marker,
                        # there is no need to try a database query.
                        pass
                    else:
                        # 2.3, fetch from database
                        try:
                            object = self._get_translated_queryset(meta).get(language_code=language_code)
                        except meta.model.DoesNotExist:
                            pass
                        else:
                            local_cache[language_code] = object
                            _cache_translation(object)  # Store in memcached
                            return object

        # Not in cache, or default.
        # Not fetched from DB

        # 3. Auto create?
        if auto_create:
            # Auto create policy first (e.g. a __set__ call)
            kwargs = {
                'language_code': language_code,
            }
            if self.pk:
                # ID might be None at this point, and Django does not allow that.
                kwargs['master'] = self

            object = meta.model(**kwargs)
            local_cache[language_code] = object
            # Not stored in memcached here yet, first fill + save it.
            return object

        # 4. Fallback?
        fallback_msg = None
        lang_dict = get_language_settings(language_code)

        if language_code not in local_cache:
            # Explicitly set a marker for the fact that this translation uses the fallback instead.
            # Avoid making that query again.
            local_cache[language_code] = MISSING  # None value is the marker.
            if not self._state.adding or self.pk is not None:
                _cache_translation_needs_fallback(self, language_code, related_name=meta.rel_name)

        fallback_choices = [lang_dict['code']] + list(lang_dict['fallbacks'])
        if use_fallback and fallback_choices:
            # Jump to fallback language, return directly.
            # Don't cache under this language_code
            for fallback_lang in fallback_choices:
                if fallback_lang == language_code:  # Skip the current language, could also be fallback 1 of 2 choices
                    continue

                try:
                    return self._get_translated_model(fallback_lang, use_fallback=False, auto_create=auto_create, meta=meta)
                except meta.model.DoesNotExist:
                    pass

            fallback_msg = " (tried fallbacks {0})".format(', '.join(lang_dict['fallbacks']))

        # None of the above, bail out!
        raise meta.model.DoesNotExist(
            "{0} does not have a translation for the current language!\n"
            "{0} ID #{1}, language={2}{3}".format(self._meta.verbose_name, self.pk, language_code, fallback_msg or ''
        ))
1133369
def getBestTranslation(basedir, lang=None):
    
    if not lang:
        lang = QtCore.QLocale.system().uiLanguages()

    for l in lang:

        l = l.translate({ord('_'): '-'})
        f = os.path.join(basedir, l+'.qm')
        if os.path.isfile(f): break

        l = l.translate({ord('-'): '_'})
        f = os.path.join(basedir, l+'.qm')
        if os.path.isfile(f): break

        l = l.split('_')[0]
        f = os.path.join(basedir, l+'.qm')
        if os.path.isfile(f): break

    else:
        return None

    translator = QtCore.QTranslator()
    translator.load(f)
    return translator
1066469
public boolean isMarkedNoTranslation(Set<Locale> locales) {

        if (m_noTranslation == null) {
            return false;
        }
        List<Locale> noTranslationLocales = CmsLocaleManager.getLocales(m_noTranslation);
        for (Locale locale : noTranslationLocales) {
            if (locales.contains(locale)) {
                return true;
            }
        }
        return false;
    }
1111319
def __has_language(self, bundleId, languageId):
        
        return True if self.__get_language_data(bundleId=bundleId,
                                                languageId=languageId) \
                    else False
979107
public boolean hasErrors(){
		if(this.messageHandlers.containsKey(E_MessageType.ERROR)){
			return (this.messageHandlers.get(E_MessageType.ERROR).getCount()==0)?false:true;
		}
		return false;
	}
1098907
def fields_need_translation(self, elem, destination_lang):
        

        fields = self._get_translated_field_names(elem)
        elem_langs = elem.get_available_languages()
        # if we don't have a translation for the destination lang we have to include the tuple
        if destination_lang not in elem_langs:
            return fields

        # we have the translation, we decide which fields we need to translate. we have to get the translation first
        translation = get_translation(elem, destination_lang)
        result = []
        for field in fields:
            value = getattr(translation, field, '')
            if not value or value.strip() == '':
                result.append(field)

        return result
161644
def _has_skip(self, msg):
        '''
        
        '''
        for skip in self.skips:
            if re.search(skip, msg):
                return True
        return False
638890
public boolean isPureTranslation() {
		if (isPureCrystalTranslation()) return true;
		if (SpaceGroup.deltaComp(matTransform.m00,1,SpaceGroup.DELTA) &&
			SpaceGroup.deltaComp(matTransform.m01,0,SpaceGroup.DELTA) &&
			SpaceGroup.deltaComp(matTransform.m02,0,SpaceGroup.DELTA) &&

			SpaceGroup.deltaComp(matTransform.m10,0,SpaceGroup.DELTA) &&
			SpaceGroup.deltaComp(matTransform.m11,1,SpaceGroup.DELTA) &&
			SpaceGroup.deltaComp(matTransform.m12,0,SpaceGroup.DELTA) &&

			SpaceGroup.deltaComp(matTransform.m20,0,SpaceGroup.DELTA) &&
			SpaceGroup.deltaComp(matTransform.m21,0,SpaceGroup.DELTA) &&
			SpaceGroup.deltaComp(matTransform.m22,1,SpaceGroup.DELTA) &&
			(	Math.abs(matTransform.m03-0.0)>SpaceGroup.DELTA ||
				Math.abs(matTransform.m13-0.0)>SpaceGroup.DELTA ||
				Math.abs(matTransform.m23-0.0)>SpaceGroup.DELTA)) {
			return true;
		}

		return false;
	}
359109
function checkKeyExists(key) {
    var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'fallback';
    // get the current language from the store
    var locale = store.state[moduleName].locale;
    var fallback = store.state[moduleName].fallback;
    var translations = store.state[moduleName].translations; // check the current translation

    if (translations.hasOwnProperty(locale) && translations[locale].hasOwnProperty(key)) {
      return true;
    }

    if (scope == 'strict') {
      return false;
    } // check any localized translations


    var localeRegional = locale.split('-');

    if (localeRegional.length > 1 && translations.hasOwnProperty(localeRegional[0]) && translations[localeRegional[0]].hasOwnProperty(key)) {
      return true;
    }

    if (scope == 'locale') {
      return false;
    } // check if a fallback locale exists


    if (translations.hasOwnProperty(fallback) && translations[fallback].hasOwnProperty(key)) {
      return true;
    } // key does not exist in the store


    return false;
  }
467449
def get_translations(self):
        
        ctx = _request_ctx_stack.top
        if ctx is None:
            return NullTranslations()

        locale = get_locale()

        cache = self.get_translations_cache(ctx)

        translations = cache.get(str(locale))

        if translations is None:
            translations = self._get_translation_for_locale(locale)
            cache[str(locale)] = translations

        return translations
1064024
def _get_fieldtranslations(instance, field=None, lang=None):
	

	# Basic filtering: filter translations by module, model an object_id
	_filter = {"module": instance.__module__, "model": instance.__class__.__name__, "object_id": instance.id}

	if lang:
		_filter["lang"] = lang

	# If we specify a field we get ONE translation (this field translation)
	if field:
		_filter["field"] = field
		try:
			return FieldTranslation.objects.get(**_filter)
		except FieldTranslation.DoesNotExist:
			return False

	# Otherwise, we get all translations
	return FieldTranslation.objects.filter(**_filter)
631568
def __get_return_value(self, messageKey, value):
        
        # if value is not None, return it
        # otherwise, either use the Translations fallback if there is one,
        # or return the message key back
        if value:
            return value
        else:
            if self._fallback:
                return self._fallback.gettext(messageKey)
            else:
                return messageKey
429182
def to_text(self):
        
        message = ''
        last_was_text = False
        for m in self.message:
            if last_was_text and not isinstance(m, Text):
                message += '\n'

            message += m.to_text()

            if isinstance(m, Text):
                last_was_text = True
            else:
                message += '\n'
                last_was_text = False
        return message
1025578
def with_translations(self, **kwargs):
        

        force = kwargs.pop("force", False)

        if self._prefetch_translations_done and force is False:
            return self

        self._prefetched_translations_cache = utils.get_grouped_translations(
            self, **kwargs
        )
        self._prefetch_translations_done = True

        return self._clone()
589061
def _get_translation(self, lang):
        """"""

        try:
            return self._translations[lang]
        except KeyError:
            # The fact that `fallback=True` is not the default is a serious design flaw.
            rv = self._translations[lang] = gettext.translation(self._domain, localedir=localedir, languages=[lang],
                                                                fallback=True)
            return rv
278194
public function checkIsPublished(ActiveRecord $translationRecord)
    {
        if ($this->translationPublishedAttribute === false) {
            return true;
        }
        return
            $translationRecord->getAttribute($this->translationPublishedAttribute)
            == $this->translationPublishedAttributeValue;
    }