Gets a translated topic based on a topic id, revision and locale.
357952
public static TranslatedTopicWrapper getTranslatedTopicByTopicId(final DataProviderFactory providerFactory, final Integer id,
            final Integer rev, final String locale) {
        return getTranslatedTopicByTopicAndNodeId(providerFactory, id, rev, null, locale);
    }
222086
def get_golden_topics(self, lang):
        """"""
        return [topic['title']
                for topic in self.user_data.language_data[lang]['skills']
                if topic['learned'] and topic['strength'] == 1.0]
206738
public Topic getTopic(String topicName) throws ServiceLocatorException {
    Topic topic = null;
    try {
      if (cache.containsKey(topicName)) {
        topic = (Topic) cache.get(topicName);
      } else {
        topic = (Topic) ic.lookup(topicName);
        cache.put(topicName, topic);
      }
    } catch (NamingException ne) {
      throw new ServiceLocatorException(ne);
    } catch (Exception e) {
      throw new ServiceLocatorException(e);
    }
    return topic;
  }
1339830
public static TranslatedContentSpecWrapper getTranslatedContentSpecById(final DataProviderFactory providerFactory, final Integer id,
            final Integer rev) {
        final CollectionWrapper<TranslatedContentSpecWrapper> translatedContentSpecs = providerFactory.getProvider(
                ContentSpecProvider.class).getContentSpecTranslations(id, rev);

        if (translatedContentSpecs != null) {
            final List<TranslatedContentSpecWrapper> translatedContentSpecItems = translatedContentSpecs.getItems();
            for (final TranslatedContentSpecWrapper translatedContentSpec : translatedContentSpecItems) {
                if (rev != null && translatedContentSpec.getContentSpecRevision().equals(rev)) {
                    return translatedContentSpec;
                } else if (rev == null) {
                    return translatedContentSpec;
                }
            }
        }

        return null;
    }
1170966
def get_localized_docstring(obj, domain):
    """"""
    if obj.__class__.__doc__ is not None:
        return inspect.cleandoc(
            gettext.dgettext(domain, obj.__class__.__doc__))
804715
function getText(locale, ...args) {
    const key = args[0];
    if (!key) return null;

    // try locale
    let resource = ebLocales[locale] || {};
    let text = resource[key];
    if (text === undefined && locale !== 'en-us') {
      // try en-us
      resource = ebLocales['en-us'] || {};
      text = resource[key];
    }
    // equal key
    if (text === undefined) {
      text = key;
    }
    // format
    args[0] = text;
    return localeutil.getText.apply(localeutil, args);
  }
826731
public String getMessage(String key, Locale locale)
	{
		if (null == locale)
		{
			return getMessage(key);
		}
		return CollectionTools.getString(getResourceBundle(locale), key, getBehaviourOnMissingMessage().getValueOnMissingMessage(key));
	}
479340
def get_unknown_topics(self, lang):
        """"""
        return [topic['title']
                for topic in self.user_data.language_data[lang]['skills']
                if not topic['learned']]
1055653
def get_known_topics(self, lang):
        """"""
        return [topic['title']
                for topic in self.user_data.language_data[lang]['skills']
                if topic['learned']]
743652
function (request, response) {
      var locale = request.params.locale;
      var phrase = request.params.phrase;

      var result;
      if (request.query.plural) {
        var singular = phrase;
        var plural = request.query.plural;
        // Make sure the information is added to the catalog if it doesn't exist yet.
        var translated = vulpejs.i18n.__n({
          singular: singular,
          plural: plural,
          count: request.query.count,
          locale: locale,
        });
        // Retrieve the translation object from the catalog and return it.
        var catalog = vulpejs.i18n.getCatalog(locale);
        result = singular.split(configuration.objectNotation).reduce(function (object, index) {
          return object[index];
        }, catalog);
      } else {
        result = vulpejs.i18n.__({
          phrase: phrase,
          locale: locale,
        });
      }
      response.send(result);
    }
223229
def pull(self):
        """"""

        topic_stats = txlib.api.statistics.Statistics.get(
            project_slug=self.tx_project_slug,
            resource_slug=self.TOPIC_STRINGS_SLUG,
        )

        translated = {}

        # for each language
        for locale in self.enabled_locales:

            if not self._process_locale(locale):
                continue

            locale_stats = getattr(topic_stats, locale, None)
            if locale_stats is None:
                self.log.debug('Locale %s not present when pulling topics.' %
                               (locale,))
                continue

            if locale_stats['completed'] == '100%':
                # get the resource from Tx
                translation = txlib.api.translations.Translation.get(
                    project_slug=self.tx_project_slug,
                    slug=self.TOPIC_STRINGS_SLUG,
                    lang=locale,
                )

                translated[locale] = babel.messages.pofile.read_po(
                    StringIO(translation.content.encode('utf-8'))
                )

        # now that we've pulled everything from Tx, upload to Desk
        for topic in self.desk.topics():

            for locale in translated:

                if topic.name in translated[locale]:

                    self.log.debug(
                        'Updating topic (%s) for locale (%s)' %
                        (topic.name, locale),
                    )

                    if locale in topic.translations:
                        topic.translations[locale].update(
                            name=translated[locale][topic.name].string,
                        )
                    else:
                        topic.translations.create(
                            locale=locale,
                            name=translated[locale][topic.name].string,
                        )
                else:

                    self.log.error(
                        'Topic name (%s) does not exist in locale (%s)' %
                        (topic['name'], locale),
                    )
1292077
public static String getTranslatedTopicBuildKey(final TranslatedTopicWrapper translatedTopic,
            final TranslatedCSNodeWrapper translatedCSNode) {
        String topicKey = getBaseTopicBuildKey(translatedTopic);
        return translatedCSNode == null ? topicKey : (topicKey + "-" + translatedCSNode.getId());
    }
26284
def topic(self):
        
        if self.api and self.topic_id:
            return self.api._get_topic(self.topic_id)
383029
def fetch_attribute(locale, name)
      translation = record.translation_for(locale)
      return translation && translation.send(name)
    end
648428
def resource_url(self, entity_id, name, revision):
        '''
        
        '''
        return '{}/{}/resource/{}/{}'.format(self.url,
                                             _get_path(entity_id),
                                             name,
                                             revision)
416958
def help_center_section_translation_update(self, section_id, locale, data, **kwargs):
        ""
        api_path = "/api/v2/help_center/sections/{section_id}/translations/{locale}.json"
        api_path = api_path.format(section_id=section_id, locale=locale)
        return self.call(api_path, method="PUT", data=data, **kwargs)
547569
def _get_content(self, params, mode_translate):
        
        token = self._get_token()
        headers = {'Authorization': 'Bearer '+ token}
        parameters = params
        translation_url = mode_translate
        return self._make_request(parameters, translation_url, headers)