[ALOY-781] Add option to extract-i18n to remove strings not used in code
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | n/a |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2013-10-02T18:08:02.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Tooling |
Labels | alloy, extraction, i18n |
Reporter | Fokke Zandbergen |
Assignee | Tony Lukasavage |
Created | 2013-08-12T13:37:51.000+0000 |
Updated | 2014-01-28T23:19:51.000+0000 |
Description
I would to have an option for
alloy extract-i18n
to remove strings that can not be found in the project's JS, TSS and XML files.
Of course this requires TC-2732 to be resolved because ATM, extract-i18n
does not account for XML files and textid
-like properties.
I will attach a PR for this.
PR: https://github.com/appcelerator/alloy/pull/218
Can you better define what "unused" strings are?
This seems a little dangerous from my perspective and likely to be misused with bad results. The reason I've allowed extract-i18n in as it is with regex search instead of full AST parsing is that its changes are non-invasive. The changes are additive. That's not to say that we can't do it, I just think the interface will need to be more explicit. Makes me wonder if the command should be structured differently, with subcommands:
instead of
and then add
so that the very different behavior is more explicit. Not sure, but I do know that if this command gets into the business of actually removing entries, then I don't want it to be regex driven anymore and it should fully parse the JS/TSS into an AST and manipulate that way. The views would naturally be parsed as XML and evaluated in a similar fashion.
Well I don't actually remove the strings, just wrap them in comments. But I do agree that an
extract
command also removing stuff might be unexpected behavior. We could do:I also agree that proper AST and XML parsing is justifiable, also taking ALOY-782 into consideration (which is required for this issue anyway).
After discussion with Fokke, this ticket will be closed. Further effort here may be made in the next major version of Alloy, but that will likely be covered in entirely separate issues.