Le 15 décembre 2020 05:53:56 GMT-05:00, Zhu Zihao <all_but_last@163.com> a écrit :
Hi, Guix users!
Currently I'm putting my energy into Guix l10n(zh_CN). However, there's
a serious flaw in current implementation of l10n.
AFAFIK, Guix use format in (ice-9 format) to format the the template
string return by `G_`. The template string of (ice-9 format) looks
similar to the format template defined in ANSI CL, which only supports
format arguments **one by one**.
In CJK languages, word order usually different from English.
For example. consider message
"could not find bootstrap binary '~a' for system '~a'"
We mark first ~a as %1 and mark second as %2. It should be translated
into Chinese like this
"无法找到用于引导 %2 系统的二进制文件 %1"
But currently it looks to be impossible because we can't refer
to positional argument in format template.
My suggestions is we can create a new format function supports refer to
positional argument like
(pos-format "~3 ~2 ~1" "foo" "bar" "baz") ;; => "baz bar foo"
And replace `format` in l10n with `pos-format` step by step. Maybe we
can create a function to combine `G_` and `format` so we can change its
implement detail without breaking existing code.
Please leave your comment on my opinion, thanks :)