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

Unified Diff: tools/grit/grit/format/chrome_messages_json.py

Issue 1676793002: Skip missing translations when generating JSON resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix fake-bidi support Created 3 years, 6 months 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 | « no previous file | tools/grit/grit/format/chrome_messages_json_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/grit/grit/format/chrome_messages_json.py
diff --git a/tools/grit/grit/format/chrome_messages_json.py b/tools/grit/grit/format/chrome_messages_json.py
old mode 100755
new mode 100644
index 27ac36135f40b727c36fd669bc34902ef407781b..4c701c67fa65e9ff88cd444889016f1f9063139b
--- a/tools/grit/grit/format/chrome_messages_json.py
+++ b/tools/grit/grit/format/chrome_messages_json.py
@@ -1,4 +1,3 @@
-#!/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.
@@ -10,6 +9,7 @@ from json import JSONEncoder
import re
import types
+from grit import constants
from grit import util
from grit.node import message
@@ -31,6 +31,13 @@ def Format(root, lang='en', output_dir='.'):
if id.startswith('IDR_') or id.startswith('IDS_'):
id = id[4:]
+ translation_missing = child.GetCliques()[0].clique.get(lang) is None;
+ if (child.ShouldFallbackToEnglish() and translation_missing and
+ lang != constants.FAKE_BIDI):
+ # Skip the string if it's not translated. Chrome will fallback
+ # to English automatically.
+ continue
+
loc_message = encoder.encode(child.ws_at_start + child.Translate(lang) +
child.ws_at_end)
« no previous file with comments | « no previous file | tools/grit/grit/format/chrome_messages_json_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698