https://developer.zendesk.com/rest_api/docs/help_center/translations#list-translations
975819
def help_center_section_translations(self, section_id, **kwargs):
        ""
        api_path = "/api/v2/help_center/sections/{section_id}/translations.json"
        api_path = api_path.format(section_id=section_id)
        return self.call(api_path, **kwargs)
1060879
def _get_translations_multi_paths():
    
    ctx = _request_ctx_stack.top
    if ctx is None:
        return None

    translations = getattr(ctx, "babel_translations", None)
    if translations is None:
        babel_ext = ctx.app.extensions["babel"]
        translations = None
        trs = None

        # reverse order: thus the application catalog is loaded last, so that
        # translations from libraries can be overriden
        for (dirname, domain) in reversed(babel_ext._translations_paths):
            trs = Translations.load(
                dirname, locales=[flask_babel.get_locale()], domain=domain
            )

            # babel.support.Translations is a subclass of
            # babel.support.NullTranslations, so we test if object has a 'merge'
            # method

            if not trs or not hasattr(trs, "merge"):
                # got None or NullTranslations instance
                continue
            elif translations is not None and hasattr(translations, "merge"):
                translations.merge(trs)
            else:
                translations = trs

        # ensure translations is at least a NullTranslations object
        if translations is None:
            translations = trs

        ctx.babel_translations = translations

    return translations
262843
def get_list(client, list_id):
    '''  '''
    endpoint = '/'.join([client.api.Endpoints.LISTS, str(list_id)])
    response = client.authenticated_request(endpoint)
    return response.json()
599599
def get_translations(self, context_id):
        
        _mask = ('[mask[addressTranslations[customerIpAddressRecord,'
                 'internalIpAddressRecord]]]')
        context = self.get_tunnel_context(context_id, mask=_mask)
        # Pull the internal and remote IP addresses into the translation
        for translation in context.get('addressTranslations', []):
            remote_ip = translation.get('customerIpAddressRecord', {})
            internal_ip = translation.get('internalIpAddressRecord', {})
            translation['customerIpAddress'] = remote_ip.get('ipAddress', '')
            translation['internalIpAddress'] = internal_ip.get('ipAddress', '')
            translation.pop('customerIpAddressRecord', None)
            translation.pop('internalIpAddressRecord', None)
        return context['addressTranslations']
945785
def get_translations(self):
        
        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_dir = self.get_translations_path(ctx)
            translations = Translations.load(translations_dir, locale,
                                             domain=self.domain)

            # Load plugins translations
            if isinstance(translations, Translations):
                # Load core extensions translations
                from wtforms.i18n import messages_path
                wtforms_translations = Translations.load(messages_path(),
                                                         locale,
                                                         domain='wtforms')
                translations.merge(wtforms_translations)

                import flask_security
                flask_security_translations = Translations.load(
                    join(flask_security.__path__[0], 'translations'),
                    locale,
                    domain='flask_security'
                )
                translations.merge(flask_security_translations)

                for pkg in entrypoints.get_roots(current_app):
                    package = pkgutil.get_loader(pkg)
                    path = join(package.filename, 'translations')
                    domains = [f.replace(path, '').replace('.pot', '')[1:]
                               for f in iglob(join(path, '*.pot'))]
                    for domain in domains:
                        translations.merge(Translations.load(path, locale,
                                                             domain=domain))

                # Allows the theme to provide or override translations
                from . import theme

                theme_translations_dir = join(theme.current.path, 'translations')
                if exists(theme_translations_dir):
                    domain = theme.current.identifier
                    theme_translations = Translations.load(theme_translations_dir,
                                                           locale,
                                                           domain=domain)
                    translations.merge(theme_translations)

                cache[str(locale)] = translations

        return translations
56004
def _translate_errors(self, errors, translate):
        
        for prop in errors:
            prop_errors = errors[prop]

            # state and simple
            if type(prop_errors) is list:
                for index, error in enumerate(prop_errors):
                    message = translate(error.message)
                    message = self.format_error(message, error.kwargs)
                    errors[prop][index] = message

            # entity and collection direct
            if type(prop_errors) is dict and 'direct' in prop_errors:
                for index, error in enumerate(prop_errors['direct']):
                    message = translate(error.message)
                    message = self.format_error(message, error.kwargs)
                    errors[prop]['direct'][index] = message

            # entity schema
            if type(prop_errors) is dict and 'schema' in prop_errors:
                errors[prop]['schema'] = self._translate_errors(
                    prop_errors['schema'],
                    translate
                )

            # collection schema
            if type(prop_errors) is dict and 'collection' in prop_errors:
                translated = dict()
                for index, result in prop_errors['collection'].items():
                    translated[index] = self._translate_errors(
                        result.errors,
                        translate
                    )
                    errors[prop]['collection'] = translated

        return errors
604178
function fetchTranslations() {
            var api = getApi();
            var url = api.baseUrl + api.path;
            var requestOptions;
            var queryParams = { 'source_file_name': options.sourceFile };

            if (options.exportType === 'multilingual') {
                url = url + 'translations/multilingual';
                queryParams = _.extend(queryParams, { 'file_format': 'I18NEXT_MULTILINGUAL_JSON' });
            }

            if (options.exportType === 'locale') {
                url = url + 'translations';
                queryParams = _.extend(queryParams, { 'locale': options.locale });
            }

            requestOptions = {
                method: 'GET',
                url: url,
                headers: {
                    'Content-Type': 'application/json'
                },
                qs: {
                    'api_key': api.publicKey,
                    'timestamp': api.timestamp,
                    'dev_hash': api.devHash
                }
            };

            requestOptions.qs = _.extend(requestOptions.qs, queryParams);

            return request(requestOptions, onFetchTranslations);
        }
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
190236
public function translate(Google_Service_Translate_TranslateTextRequest $postBody, $optParams = array())
  {
    $params = array('postBody' => $postBody);
    $params = array_merge($params, $optParams);
    return $this->call('translate', array($params), "Google_Service_Translate_TranslationsListResponse");
  }
31302
def help_center_articles_labels_list(self, locale=None, **kwargs):
        ""
        api_path = "/api/v2/help_center/articles/labels.json"
        if locale:
            api_opt_path = "/api/v2/help_center/{locale}/articles/labels.json"
            api_path = api_opt_path.format(locale=locale)
        return self.call(api_path, **kwargs)
431131
def translations_link(self):
        
        translation_type = ContentType.objects.get_for_model(Translation)
        link = urlresolvers.reverse('admin:%s_%s_changelist' % (
            translation_type.app_label,
            translation_type.model),
        )

        object_type = ContentType.objects.get_for_model(self)
        link += '?content_type__id__exact=%s&object_id=%s' % (object_type.id, self.id)
        return '<a href="%s">translate</a>' % link
73055
def translate_docs(self, ds, **kwargs):
        
        for d in ds:
            self.map_doc(d, {}, self.invert_subject_object)

        return [self.translate_doc(d, **kwargs) for d in ds]
557151
def view_all(request, language, filter=None):
	

	# Is there any filter?
	if request.method == "POST":
		data = request.POST.dict()

		if not data["search"] or data["search"]=="":
			return HttpResponseRedirect(reverse("modeltranslation:view_all_url",args=(data["language"],data["filter"])))

		return HttpResponseRedirect(reverse("modeltranslation:view_all_url",args=(data["language"],data["filter"]))+"?search="+data["search"])

	LANGUAGES = dict(lang for lang in settings.LANGUAGES)
	if language not in LANGUAGES.keys():
		raise Http404(u"Language {0} does not exist".format(language))
	
	if language == settings.LANGUAGE_CODE:
		raise Http404(u"El idioma {0} es el idioma por defecto".format(language))

	# Translation filter
	trans_filter = {"lang":language}
	if filter == "all" or filter is None:
		pass
	elif filter == "fuzzy":
		trans_filter["is_fuzzy"] = True
	elif filter == "completed":
		trans_filter["is_fuzzy"] = False
	
	search_query = ""
	if request.GET and "search" in request.GET and request.GET.get("search")!="":
		search_query = request.GET.get("search")
		trans_filter["source_text__icontains"] = search_query

	translations = FieldTranslation.objects.filter(**trans_filter)
	
	# Update translations
	active_translations = []
	for translation in translations:
		source_model = translation.get_source_model()
		if not translation.field in source_model._meta.translatable_fields:
			translation.delete()
		else:
			active_translations.append(translation)
	
	replacements = {"translations":active_translations, "filter":filter, "lang":language, "language":LANGUAGES[language], "search_query":search_query}
	return render_to_response('modeltranslation/admin/list.html',replacements, RequestContext(request))
1223757
def get_obj_values(obj, translated_field_names):
        
        # set of translated fields to list
        fields = list(translated_field_names)
        values = {field: getattr(obj, field) for field in fields}
        return values
295525
def lazy_translations(cls):
        """"""
        return {
            cloudfiles.errors.NoSuchContainer: errors.NoContainerException,
            cloudfiles.errors.NoSuchObject: errors.NoObjectException,
        }
94108
def _get_translate():
    
    translate = {}
    model_path = pkg_resources.resource_filename('hwrt', 'misc/')
    translation_csv = os.path.join(model_path, 'latex2writemathindex.csv')
    arguments = {'newline': '', 'encoding': 'utf8'}
    with open(translation_csv, 'rt', **arguments) as csvfile:
        contents = csvfile.read()
    lines = contents.split("\n")
    for csvrow in lines:
        csvrow = csvrow.split(',')
        if len(csvrow) == 1:
            writemathid = csvrow[0]
            latex = ""
        else:
            writemathid, latex = csvrow[0], csvrow[1:]
            latex = ','.join(latex)
        translate[latex] = writemathid
    return translate
37432
def help_center_section_translation_create(self, section_id, data, **kwargs):
        ""
        api_path = "/api/v2/help_center/sections/{section_id}/translations.json"
        api_path = api_path.format(section_id=section_id)
        return self.call(api_path, method="POST", data=data, **kwargs)