tools/android/remove_strings.py
def RemoveStrings(grd_path, string_names):
  """Removes strings with the given names from a GRD file. Overwrites the file.

  Args:
    grd_path: path to the GRD file.
    string_names: a list of string names to be removed.
  """
  with open(grd_path, 'r') as f:
    grd = f.read()
  names_pattern = '|'.join(map(re.escape, string_names))
  pattern = r'<message [^>]*name="(%s)".*?</message>\s*' % names_pattern
  grd = re.sub(pattern, '', grd, flags=re.DOTALL)
  with open(grd_path, 'w') as f:
    f.write(grd)
Removes strings with the given names from a GRD file. Overwrites the file.

  Args:
    grd_path: path to the GRD file.
    string_names: a list of string names to be removed.
  
Removes strings with the given names from a GRD file. Overwrites the file.
Removes strings with the given names from a GRD file . Overwrites the file .
def RemoveStrings(grd_path, string_names):
  with open(grd_path, 'r') as f:
    grd = f.read()
  names_pattern = '|'.join(map(re.escape, string_names))
  pattern = r'<message [^>]*name="(%s)".*?</message>\s*' % names_pattern
  grd = re.sub(pattern, '', grd, flags=re.DOTALL)
  with open(grd_path, 'w') as f:
    f.write(grd)
def RemoveStrings ( grd_path , string_names ) : with open ( grd_path , 'r' ) as f : grd = f . read ( ) names_pattern = '|' . join ( map ( re . escape , string_names ) ) pattern = r'<message [^>]*name="(%s)".*?</message>\s*' % names_pattern grd = re . sub ( pattern , '' , grd , flags = re . DOTALL ) with open ( grd_path , 'w' ) as f : f . write ( grd )
Removes strings with the given names from a GRD file.
Removes strings with the given names from a GRD file .
"""Removes strings with the given names from a GRD file. Overwrites the file.

  Args:
    grd_path: path to the GRD file.
    string_names: a list of string names to be removed.
  """
grd_path
path to the GRD file.
path to the GRD file .
string_names
a list of string names to be removed.
a list of string names to be removed .