Make --doctool locale aware

* Adds `indent(prefix)` to `String`
* Moves the loading of tool/doc translation into
  `editor/editor_translation.{h,cpp}`
* Makes use of doc translation when generating XML class references, and
  setup the translation locale based on `-l LOCALE` CLI parameter.

The XML class reference won't be translated if `-l LOCALE` parameter is
not given, or when it's `-l en`.
This commit is contained in:
Haoyu Qiu 2021-12-16 18:22:44 +08:00
parent 14d439d868
commit c11b1850c4
9 changed files with 223 additions and 64 deletions

View file

@ -272,6 +272,7 @@ struct _VariantCall {
VCALL_LOCALMEM0R(String, to_lower);
VCALL_LOCALMEM1R(String, left);
VCALL_LOCALMEM1R(String, right);
VCALL_LOCALMEM1R(String, indent);
VCALL_LOCALMEM0R(String, dedent);
VCALL_LOCALMEM2R(String, strip_edges);
VCALL_LOCALMEM0R(String, strip_escapes);
@ -1681,6 +1682,7 @@ void register_variant_methods() {
ADDFUNC0R(STRING, STRING, String, get_basename, varray());
ADDFUNC1R(STRING, STRING, String, plus_file, STRING, "file", varray());
ADDFUNC1R(STRING, INT, String, ord_at, INT, "at", varray());
ADDFUNC1R(STRING, STRING, String, indent, STRING, "prefix", varray());
ADDFUNC0R(STRING, STRING, String, dedent, varray());
ADDFUNC2(STRING, NIL, String, erase, INT, "position", INT, "chars", varray());
ADDFUNC0R(STRING, INT, String, hash, varray());