ahvn.utils.exts.autoi18n module

ahvn.utils.exts.autoi18n.autoi18n(path, src_lang=None, tgt_lang=None, overwrite=False, batch_size=20, hints=None, llm_args=None, **kwargs)[源代码]

Translate Babel .po files with an LLM.

参数:
  • path (str) -- The root directory containing the 'locale' folder.

  • src_lang (Optional[str]) -- The main language of the POT file. Defaults to None, which will use the encoding in the config file ("prompts.main").

  • tgt_lang (Optional[str]) -- The target language to translate to. Defaults to None, which will use the encoding in the config file ("prompts.lang").

  • overwrite (bool) -- Overwrite existing translations. Defaults to False.

  • batch_size (int) -- Number of entries to process in each batch. Defaults to 10.

  • llm_args (Optional[Dict]) -- Arguments for the LLM model. Defaults to None, which will resolve to {"preset": "translator"}

  • **kwargs -- Additional keyword arguments passed to cmd (subprocess.Popen).

  • hints (List[str] | None)