(self, media_attr, lang, strict=False, build_profile_id=None)
Return media-path for given language if one exists, else 1st path in the
        sorted lang->media-path list

        *args:
            media_attr: one of 'media_image' or 'media_audio'
            lang: language code
        **kwargs:
            strict: whether to return None if media-path is not set for lang or
                to return first path in sorted lang->media-path list
            build_profile_id: If this is provided and strict is False, only return
                media in one of the profile's languages
Return media-path for given language if one exists, else 1st path in the
        sorted lang->media-path list
Return media - path for given language if one exists else 1st path in the sorted lang - > media - path list
def _get_media_by_language(self, media_attr, lang, strict=False, build_profile_id=None):
        """
        Return media-path for given language if one exists, else 1st path in the
        sorted lang->media-path list

        *args:
            media_attr: one of 'media_image' or 'media_audio'
            lang: language code
        **kwargs:
            strict: whether to return None if media-path is not set for lang or
                to return first path in sorted lang->media-path list
            build_profile_id: If this is provided and strict is False, only return
                media in one of the profile's languages
        """
        assert media_attr in ('media_image', 'media_audio')
        app = self.get_app()

        if ((self.use_default_image_for_all and media_attr == 'media_image')
                or (self.use_default_audio_for_all and media_attr == 'media_audio')):
            lang = app.default_language

        media_dict = getattr(self, media_attr)
        if not media_dict:
            return None
        if media_dict.get(lang, ''):
            return media_dict[lang]
        if not strict:
            # if the queried lang key doesn't exist,
            # return the first in the sorted list
            for lang, item in sorted(media_dict.items()):
                if not build_profile_id or lang in app.build_profiles[build_profile_id].langs:
                    return item
def _get_media_by_language ( self , media_attr , lang , strict = False , build_profile_id = None ) : assert media_attr in ( 'media_image' , 'media_audio' ) app = self . get_app ( ) if ( ( self . use_default_image_for_all and media_attr == 'media_image' ) or ( self . use_default_audio_for_all and media_attr == 'media_audio' ) ) : lang = app . default_language media_dict = getattr ( self , media_attr ) if not media_dict : return None if media_dict . get ( lang , '' ) : return media_dict [ lang ] if not strict : # if the queried lang key doesn't exist, # return the first in the sorted list for lang , item in sorted ( media_dict . items ( ) ) : if not build_profile_id or lang in app . build_profiles [ build_profile_id ] . langs : return item