Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: grit/format/js_map_format.py

Issue 1438403002: Remove contents of grit's git-svn-mirror repository. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « grit/format/html_inline_unittest.py ('k') | grit/format/js_map_format_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/format/js_map_format.py
diff --git a/grit/format/js_map_format.py b/grit/format/js_map_format.py
deleted file mode 100644
index 8cc8eb25e729282b54de8594fde1578f03b17fa2..0000000000000000000000000000000000000000
--- a/grit/format/js_map_format.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Formats as a .js file using a map: <english text> -> <localized text>.
-"""
-
-import re
-
-from grit import util
-
-
-"""The required preamble for JS files."""
-_HEADER = '// This file is automatically generated by GRIT. Do not edit.\n'
-
-
-def Format(root, lang='en', output_dir='.'):
- from grit.node import empty, message
- yield _HEADER
- for item in root.ActiveDescendants():
- with item:
- if isinstance(item, message.MessageNode):
- yield _FormatMessage(item, lang)
- elif isinstance(item, empty.MessagesNode):
- yield '\n'
-
-
-def _FormatMessage(item, lang):
- """Format a single message."""
-
- en_message = item.ws_at_start + item.Translate('en') + item.ws_at_end
- # Remove position numbers from placeholders.
- en_message = re.sub(r'%\d\$([a-z])', r'%\1', en_message)
- # Escape double quotes.
- en_message = re.sub(r'\\', r'\\\\', en_message)
- en_message = re.sub(r'"', r'\"', en_message)
-
- loc_message = item.ws_at_start + item.Translate(lang) + item.ws_at_end
- # Escape double quotes.
- loc_message = re.sub(r'\\', r'\\\\', loc_message)
- loc_message = re.sub(r'"', r'\"', loc_message)
-
- return '\nlocalizedStrings["%s"] = "%s";' % (en_message, loc_message)
« no previous file with comments | « grit/format/html_inline_unittest.py ('k') | grit/format/js_map_format_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698