Re: Concrete suggestion re: i18n messages
| From: | Maxim Maletsky | Date: | Tue, 26 Nov 2002 11:53:36 +0000 |
| Subject: | Re: Concrete suggestion re: i18n messages | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-91729@lists.php.net to get a copy of this message | ||
Sascha Schumann <sascha@schumann.cx> wrote... :
> A possible implementation would look like this:
>
> A new ini setting is added.
>
> php.error_lang
>
> A new function is provided.
>
> php_error_ex(int type, const char *err_code, const char *fmt, ...);
>
> The function tries to lookup the <err_code> key in
> php-<php.error_lang>.cat. If it exists, the value will be
> used instead of the format <fmt>. The control is then passed
> to php_verror().
>
> That sounds like 30-50 additional LOC to me. No bloat in
> sight.
>
> The program which generates the .cat files (gen-cat) will
> ensure that the error code is prepended to the format
> message. That could be a simple C file with another 50 LOC,
> parsing input files of the form
>
> file: file line | line
> line: ERROR-CODE MSG
>
> Each extension can maintain its own file (e.g. cat.session.nl for
> the NL version of the session error messages). During
> .cat build-time, a single per-language file is generated and
> fed through gen-cat. The result can then be used by PHP.
Per-extension thingies sounds nice to me - would make it easier getting the
patches with these errors from users. But, it should be in it own
directories, thought - having 20 .cat files along your .c files would be
boring.
I'd say:
ext/session/errors/en.cat
etc...
Also, a logic to always use english error as default.
> There, simple and straight-forward.
--
Maxim Maletsky
maxim@php.net