parameters: (srcdir, language_file, enc='utf-8')
return_statement: return {lang: strings}
docstring: HD Edition stores language .txt files in the resources/ folder.
      Specific language strings are in resources/$LANG/strings/key-value/*.txt.
  
      The data is stored in the `stringres` storage.
docstring_summary: HD Edition stores language .txt files in the resources/ folder.
      Specific language strings are in resources/$LANG/strings/key-value/*.txt.
docstring_tokens: HD Edition stores language . txt files in the resources / folder . Specific language strings are in resources / $LANG / strings / key - value / * . txt .
function: def read_hd_language_file(srcdir, language_file, enc='utf-8'):
      """
      HD Edition stores language .txt files in the resources/ folder.
      Specific language strings are in resources/$LANG/strings/key-value/*.txt.
  
      The data is stored in the `stringres` storage.
      """
      # Langcode is folder name
      langcode = language_file.split("/")[1]
  
      dbg("parse HD Language file %s", langcode)
      strings = {}
  
      fileobj = srcdir[language_file].open('rb')
  
      for line in fileobj.read().decode(enc).split('\n'):
          line = line.strip()
  
          # skip comments & empty lines
          if not line or line.startswith('//'):
              continue
  
          string_id, string = line.split(None, 1)
  
          # strings that were added in the HD edition release have
          # UPPERCASE_STRINGS as names, instead of the numeric ID stuff
          # of AoC.
          strings[string_id] = string
  
      fileobj.close()
  
      lang = LANGCODES_HD.get(langcode, langcode)
  
      return {lang: strings}
function_tokens: def read_hd_language_file ( srcdir , language_file , enc = 'utf-8' ) : # Langcode is folder name langcode = language_file . split ( "/" ) [ 1 ] dbg ( "parse HD Language file %s" , langcode ) strings = { } fileobj = srcdir [ language_file ] . open ( 'rb' ) for line in fileobj . read ( ) . decode ( enc ) . split ( '\n' ) : line = line . strip ( ) # skip comments & empty lines if not line or line . startswith ( '//' ) : continue string_id , string = line . split ( None , 1 ) # strings that were added in the HD edition release have # UPPERCASE_STRINGS as names, instead of the numeric ID stuff # of AoC. strings [ string_id ] = string fileobj . close ( ) lang = LANGCODES_HD . get ( langcode , langcode ) return { lang : strings }