Zend Framework: Zend_Tool_Locale Component Proposal
| Proposed Component Name | Zend_Tool_Locale |
|---|---|
| Developer Notes | http://framework.zend.com/wiki/display/ZFDEV/Zend_Tool_Locale |
| Proposers | Kim Blomqvist |
| Zend Liaison | TBD |
| Revision | 1.0 - 1 September 2010: Initial Draft. (wiki revision: 25) |
Table of Contents
1. Overview
Zend_Tool_Locale parses project source files for translation message ids. Translation resource file is created or updated according to the matches.
2. References
- Demo code in github
- The parser presented here is possibly related to Zend\Code\Scanner.
3. Component Requirements, Constraints, and Acceptance Criteria
- This component will create and update project translation resource files for array adapter
- This component will support plurals
- This component will support array keys
4. Dependencies on Other Framework Components
- Zend_Tool_Project_Provider_Abstract
5. Theory of Operation
The component is used from CLI, like this ...
zf create locale module[=application] kwords
6. Milestones / Tasks
- Milestone 1: [DONE] Working prototype
- Milestone 2: Migrate to ZF2
- Milestone 3: Working prototype checked into the incubator supporting use cases #1, #2, ...
- Milestone 4: Working prototype checked into the incubator supporting use cases #3 and #4.
- Milestone 5: Unit tests exist, work, and are checked into SVN.
- Milestone 6: Initial documentation exists.
If a milestone is already done, begin the description with "[DONE]", like this:
- Milestone #: [DONE] Unit tests ...
7. Class Index
- Zend_Tool_Locale
- Zend_FunctionParamParser
8. Use Cases
| Test files |
|---|
| UC-01 Create Finnish translations |
|---|
| UC-02 Update with additional keywords |
|---|
9. Class Skeletons
Labels:
None
4 Comments
comments.show.hideMar 15, 2011
Benoît Durand
Your link on GitHub is broken. I think that the new link is https://github.com/kblomqvist/kblom-zf1-lbr/blob/master/library/Kblom/Tool/Locale.php.
This may be an interesting idea on paper. I never thought of that.
Jun 02, 2011
Kim Blomqvist
Thank you for comment. The github link is now fixed.
I have plans to enhance the Zend_FunctionParamParser class to support file names and line numbers. With these I mean that the parser is able to tell where it found the translation message ids.
Jul 16, 2011
Kim Blomqvist
I have polished the API of the FunctionParamParser class and added a new feature that resolves the line numbers where the match occured. Next I will rewrite the tool itself and after then update this proposal page.
Feb 28, 2012
Kim Blomqvist
My FunctionParamParser should be removed and replaced by PHP-Parser (https://github.com/nikic/PHP-Parser). In addition I think this tool should be distributed as a ZF2 module.