(self, resource_slug, hq_lang_code, lock_resource)
return polib.pofile(temp_file.name)
get translations for a resource in the target lang.
        lock/freeze the resource if successfully pulled translations

        :param resource_slug: resource slug
        :param hq_lang_code: target lang code on HQ
        :param lock_resource: lock resource after pulling translation
        :return: list of POEntry objects
get translations for a resource in the target lang.
        lock/freeze the resource if successfully pulled translations
get translations for a resource in the target lang . lock / freeze the resource if successfully pulled translations
def get_translation(self, resource_slug, hq_lang_code, lock_resource):
        """
        get translations for a resource in the target lang.
        lock/freeze the resource if successfully pulled translations

        :param resource_slug: resource slug
        :param hq_lang_code: target lang code on HQ
        :param lock_resource: lock resource after pulling translation
        :return: list of POEntry objects
        """
        lang = self.transifex_lang_code(hq_lang_code)
        url = "https://www.transifex.com/api/2/project/{}/resource/{}/translation/{}/?file".format(
            self.project, resource_slug, lang
        )
        response = requests.get(url, auth=self._auth, stream=True)
        if response.status_code != 200:
            raise ResourceMissing
        temp_file = tempfile.NamedTemporaryFile()
        with open(temp_file.name, 'w', encoding='utf-8') as f:
            f.write(response.content.decode(encoding='utf-8'))
        if lock_resource:
            self.lock_resource(resource_slug)
        return polib.pofile(temp_file.name)
def get_translation ( self , resource_slug , hq_lang_code , lock_resource ) : lang = self . transifex_lang_code ( hq_lang_code ) url = "https://www.transifex.com/api/2/project/{}/resource/{}/translation/{}/?file" . format ( self . project , resource_slug , lang ) response = requests . get ( url , auth = self . _auth , stream = True ) if response . status_code != 200 : raise ResourceMissing temp_file = tempfile . NamedTemporaryFile ( ) with open ( temp_file . name , 'w' , encoding = 'utf-8' ) as f : f . write ( response . content . decode ( encoding = 'utf-8' ) ) if lock_resource : self . lock_resource ( resource_slug ) return polib . pofile ( temp_file . name )