Index: build.py
diff --git a/build.py b/build.py
index 335988bc4e9238db2c732cb324ee8a127b456025..b7233f995ecd402def1c085704c0f5e3236d608e 100644
--- a/build.py
+++ b/build.py
@@ -375,6 +375,21 @@ def updatepsl(base_dir, **kwargs):
     publicSuffixListUpdater.updatePSL(base_dir)
 
 
+@argparse_command()
+def checktranslations(base_dir, platform, **kwargs):
+    """Perform translation checks.
+
+    Checks translations files for structure and for overlong translations.
+    """
+    from buildtools.packager import readMetadata
+    metadata = readMetadata(base_dir, platform)
+
+    locale_config = read_locale_config(base_dir, platform, metadata)
+
+    import buildtools.localeTools as localetools
+    localetools.check_translations(locale_config)
+
+
 def process_args(base_dir, *args):
     if build_available_subcommands(base_dir):
         MAIN_PARSER.set_defaults(base_dir=base_dir)
Index: localeTools.py
diff --git a/localeTools.py b/localeTools.py
index 38c937b4bb26f0d00fb76f6e974e1a5fc0b8dcb4..b8596f96a4177af5501f80fa136cefa16adc73aa 100644
--- a/localeTools.py
+++ b/localeTools.py
@@ -325,3 +325,37 @@ def getTranslations(localeConfig, projectName, key):
             valid_extension = file.endswith('.json')
             if os.path.isfile(path) and valid_extension and not file in files:
                 os.remove(path)
+
+
+def check_translations(localeConfig):
+    base_path = localeConfig['base_path']
+    for locale in os.listdir(base_path):
+        jsonpath = os.path.join(base_path, locale, 'messages.json')
+
+        if not os.path.exists(jsonpath):
+            continue
+
+        with codecs.open(jsonpath, 'rb', encoding='utf-8') as f:
+            try:
+                data = json.load(f)
+                for key, value in data.iteritems():
+                    variables = set()
+                    max_length = value.get('maxLength')
+                    length = len(value['message'])
+                    if (max_length is not None and
+                            length > max_length or length > 160):
+                        print >>sys.stderr, (
+                            '{} {} -> translation might be too long.'
+                            'More then 160 chars or maxLength exceeded'
+                        ).format(locale, key)
+
+                    for match in re.finditer(r'\$(\S+?)\$', value['message']):
+                        variables.add(match.group(1))
+                    expected = set(value.get('placeholders', {}).iterkeys())
+                    if variables != expected:
+                        print >>sys.stderr, (
+                            '{} {}: Variables used are {} '
+                            'expected. Variables: {}'
+                        ).format(locale, key, variables, expected)
+            except ValueError:
+                print >>sys.stderr, locale + ', messages.json is not valid.'
