def keys_by_file(path)
      begin
        # Load strings file contents
        strings = read_strings_file(path)

        # Reject generated identifiers used by Interface Builder
        strings.reject! { |key, _| /^[a-zA-Z0-9]{3}-[a-zA-Z0-9]{2,3}-[a-zA-Z0-9]{3}/.match(key) }

        keys = Hash[strings.map do |key, value|
          [key, { value: key, comment: value.gsub(/[\r\n]/, ' ') }]
        end]

        log 'Found %s keys in file %s', keys.count, path

        keys
      rescue ArgumentError => error
        raise ArgumentError, 'Error while reading %s: %s' % [path, error]
      end
    end
def keys_by_file(path)
      begin
        # Load strings file contents
        strings = read_strings_file(path)

        # Reject generated identifiers used by Interface Builder
        strings.reject! { |key, _| /^[a-zA-Z0-9]{3}-[a-zA-Z0-9]{2,3}-[a-zA-Z0-9]{3}/.match(key) }

        keys = Hash[strings.map do |key, value|
          [key, { value: key, comment: value.gsub(/[\r\n]/, ' ') }]
        end]

        log 'Found %s keys in file %s', keys.count, path

        keys
      rescue ArgumentError => error
        raise ArgumentError, 'Error while reading %s: %s' % [path, error]
      end
    end
Read a file and collect all its keys

 @param  [Pathname] path
         the path to the .strings file to read

 @return [Hash{String => Hash}]