diff --git a/devscripts/i18n.py b/devscripts/i18n.py index 4344dfffc..229cbd8b9 100644 --- a/devscripts/i18n.py +++ b/devscripts/i18n.py @@ -74,7 +74,7 @@ class I18N_Utils(object): old_pot_file = self.get_pot_filename() + '.old' shutil.copy2(pot_file, old_pot_file) cmds = [ - 'xgettext', '-d', self.GETTEXT_DOMAIN, '-j', '-k', '-kg', '--from-code=utf-8', '-F', '-o', + 'xgettext', '-d', self.GETTEXT_DOMAIN, '-j', '-k', '-ktr', '--from-code=utf-8', '-F', '-o', pot_file] cmds.extend(glob.glob('youtube_dl/*.py') + glob.glob('youtube_dl/*/*.py')) self._run_subprocess(cmds) diff --git a/po/youtube_dl.pot b/po/youtube_dl.pot index 63425252a..b29b329c5 100644 --- a/po/youtube_dl.pot +++ b/po/youtube_dl.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-12-13 00:33+0800\n" +"POT-Creation-Date: 2015-12-13 03:32+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 04fb4ba08..0cb218174 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -51,7 +51,6 @@ from .utils import ( ExtractorError, format_bytes, formatSeconds, - g, locked_file, make_HTTPS_handler, MaxDownloadsReached, @@ -68,6 +67,7 @@ from .utils import ( sanitized_Request, std_headers, subtitles_filename, + tr, UnavailableVideoError, url_basename, version_tuple, @@ -1546,7 +1546,7 @@ class YoutubeDL(object): for ph in self._progress_hooks: fd.add_progress_hook(ph) if self.params.get('verbose'): - self.to_stdout(g('[debug] Invoking downloader on %r') % info.get('url')) + self.to_stdout(tr('[debug] Invoking downloader on %r') % info.get('url')) return fd.download(name, info) if info_dict.get('requested_formats') is not None: @@ -1590,8 +1590,8 @@ class YoutubeDL(object): filename = '%s.%s' % (filename_wo_ext, info_dict['ext']) if os.path.exists(encodeFilename(filename)): self.to_screen( - g('[download] %s has already been downloaded and ' - 'merged') % filename) + tr('[download] %s has already been downloaded and ' + 'merged') % filename) else: for f in requested_formats: new_info = dict(info_dict) @@ -1724,7 +1724,7 @@ class YoutubeDL(object): self.report_error(e.msg) if files_to_delete and not self.params.get('keepvideo', False): for old_filename in files_to_delete: - self.to_screen(g('Deleting original file %s (pass -k to keep)') % old_filename) + self.to_screen(tr('Deleting original file %s (pass -k to keep)') % old_filename) try: os.remove(encodeFilename(old_filename)) except (IOError, OSError): diff --git a/youtube_dl/downloader/common.py b/youtube_dl/downloader/common.py index 358790aaa..b15cb1b08 100644 --- a/youtube_dl/downloader/common.py +++ b/youtube_dl/downloader/common.py @@ -10,8 +10,8 @@ from ..utils import ( encodeFilename, decodeArgument, format_bytes, - g, timeconvert, + tr, ) @@ -212,10 +212,10 @@ class FileDownloader(object): def report_destination(self, filename): """Report destination filename.""" - self.to_screen(g('[download] Destination: %s') % filename) + self.to_screen(tr('[download] Destination: %s') % filename) def _report_progress_status(self, msg, is_last_line=False): - fullmsg = g('[download] ') + msg + fullmsg = tr('[download] ') + msg if self.params.get('progress_with_newline', False): self.to_screen(fullmsg) else: diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 92458bffe..4e8fce607 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -33,11 +33,11 @@ from ..utils import ( ExtractorError, fix_xml_ampersands, float_or_none, - g, int_or_none, RegexNotFoundError, sanitize_filename, sanitized_Request, + tr, unescapeHTML, unified_strdate, url_basename, @@ -504,7 +504,7 @@ class InfoExtractor(object): def report_download_webpage(self, video_id): """Report webpage download.""" - self.to_screen(g('%s: Downloading webpage') % video_id) + self.to_screen(tr('%s: Downloading webpage') % video_id) def report_age_confirmation(self): """Report attempt to confirm age.""" diff --git a/youtube_dl/extractor/testurl.py b/youtube_dl/extractor/testurl.py index f2c920951..1a4ee1220 100644 --- a/youtube_dl/extractor/testurl.py +++ b/youtube_dl/extractor/testurl.py @@ -5,7 +5,7 @@ import re from .common import InfoExtractor from ..utils import ( ExtractorError, - g, + tr, ) @@ -62,7 +62,7 @@ class TestURLIE(InfoExtractor): (num, len(testcases))), expected=True) - self.to_screen(g('Test URL: %s') % tc['url']) + self.to_screen(tr('Test URL: %s') % tc['url']) return { '_type': 'url', diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index 73435e6ec..2d5dcce95 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -42,7 +42,7 @@ from ..utils import ( unsmuggle_url, uppercase_escape, ISO3166Utils, - g, + tr, ) @@ -744,11 +744,11 @@ class YoutubeIE(YoutubeBaseInfoExtractor): def report_video_info_webpage_download(self, video_id): """Report attempt to download video info webpage.""" - self.to_screen(g('%s: Downloading video info webpage') % video_id) + self.to_screen(tr('%s: Downloading video info webpage') % video_id) def report_information_extraction(self, video_id): """Report attempt to extract video information.""" - self.to_screen(g('%s: Extracting video information') % video_id) + self.to_screen(tr('%s: Extracting video information') % video_id) def report_unavailable_format(self, video_id, format): """Report extracted video URL.""" @@ -1025,8 +1025,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor): dash_manifest_url = re.sub(r'/s/([a-fA-F0-9\.]+)', decrypt_sig, dash_manifest_url) dash_doc = self._download_xml( dash_manifest_url, video_id, - note=g('Downloading DASH manifest'), - errnote=g('Could not download DASH manifest'), + note=tr('Downloading DASH manifest'), + errnote=tr('Could not download DASH manifest'), fatal=fatal) if dash_doc is False: diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py index af6e39b87..2be3d36a5 100644 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@ -22,7 +22,7 @@ from ..utils import ( subtitles_filename, dfxp2srt, ISO639Utils, - g, + tr, ) @@ -404,7 +404,7 @@ class FFmpegMergerPP(FFmpegPostProcessor): filename = info['filepath'] temp_filename = prepend_extension(filename, 'temp') args = ['-c', 'copy', '-map', '0:v:0', '-map', '1:a:0'] - self._downloader.to_screen(g('[ffmpeg] Merging formats into "%s"') % filename) + self._downloader.to_screen(tr('[ffmpeg] Merging formats into "%s"') % filename) self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args) os.rename(encodeFilename(temp_filename), encodeFilename(filename)) return info['__files_to_merge'], info diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index b7d2043a7..e3c3c3696 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -2513,7 +2513,7 @@ class ISO3166Utils(object): return cls._country_map.get(code.upper()) -def g(s): +def tr(s): DOMAIN = 'youtube_dl' lang, _ = locale.getdefaultlocale() try: