Class LangFileParser

java.lang.Object
com.hypixel.hytale.server.core.modules.i18n.parser.LangFileParser

public class LangFileParser extends Object
  • Constructor Details

    • LangFileParser

      public LangFileParser()
  • Method Details

    • parse

      @Nonnull public static Map<String,String> parse(@Nonnull String source, @Nonnull BufferedReader reader) throws IOException
      Parses a translation file into key-value pairs.

      Example syntax: ``` # comment example # single-line example my.message = Hello, world! # multi-line example my.message = Hello\n\ world! # quoted example (preserves whitespace) my.message = " Hello world! " ```

      A malformed line is reported and skipped. An unterminated line continuation is reported and keeps the text read so far. The rest of the file still parses either way, so one bad entry cannot empty a catalog and leave the game showing raw translation keys.

      Parameters:
      source - Name of the input, used to locate malformed lines in the log.
      reader - Input source to read line-by-line.
      Returns:
      A map of parsed key-value pairs.
      Throws:
      IOException