[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gettext] JavaScript support
From: |
Daiki Ueno |
Subject: |
Re: [bug-gettext] JavaScript support |
Date: |
Tue, 16 Apr 2013 12:57:10 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
(For bug-gettext, the original article seems to be still under
moderation, possibly because of Unicode characters in the patch.
Quoting the text part)
Daiki Ueno <address@hidden> writes:
> Now that the copyright situation seems clear, I'm checking the
> JavaScript support. The attached is a revised patch based on yours
> found on github:
> https://github.com/AndyStricker/gettext-javascript
>
> I did:
>
> * remove support for '\a' and '\U', which are not supported by
> JavaScript
> * fix multiline comment handling (/* ... */)
> * make newline acceptable in regular expression literals
> * make string concatenation code in x_javascript_lex more readable
> * remove INTERPRET_ANSIC and INTERPRET_UNICODE option from
> phase7_getuc, since raw strings are not supported by JavaScript
> * treat 'else' as well as 'return' for div vs. regex check
> * add Unicode escape test
> * update document and FILES
Also I'm wondering how/whether to support format strings for JavaScript.
As noted in format-javascript.c, it has no standard printf function and
there are plenty of variants implemented in libraries:
* JS-Gettext allows %1 %2 ...
* Prototype JS has templates #{name}
* ExtJS has String.format with {1} {2} ... and Templates with {name}
* node.js accepts %j for JSON object
* Gjs and Seed provide only a small subset of C format directives
Currently format-javascript.c is merely a copy of format-python.c. One
idea is to provide a very permissive parser, which accepts all the
likely format directives starting with '%' and just counts the number
when checking.
Regards,
--
Daiki Ueno