[forge-dev] Plug-in for collect key properties list from source code with regular expressions

Pablo Palazon pablo.palazon at gmail.com
Thu May 17 15:12:58 EDT 2012


Hi!,

I've changed the command and parameters names, and I updated help in github
and forge help. Dan, thanks so much for your suggest, it improve this
plugin.

Cheers,

p.

On Mon, May 14, 2012 at 8:33 AM, Pablo Palazon <pablo.palazon at gmail.com>wrote:

> Hi Dan!, Thanks for your suggestion!, it's very interesting, and I'll do
> this change. You're right when you say to make the commands more intuitive
> and similar to others programs as eclipse.
>
> Very helpful.
>
>
> On Sat, May 12, 2012 at 9:18 AM, Dan Allen <dan.j.allen at gmail.com> wrote:
>
>> Hey Pablo,
>>
>> Thanks for sharing this plugin! It's exciting to learn about new ways the
>> community is using Forge to make development life easier!
>>
>> I'm always thinking about names for things, so I'd like to offer some
>> ideas I think would make the commands more intuitive. If you don't like the
>> suggestions, just say so :)
>>
>> Command name: rxlist
>>
>> As I understand it, your plugin collects language keys from source files
>> (like *.java) and puts those keys into message bundles (Java properties
>> files). A more intutive name for the command might be one of the following:
>>
>> - extract-keys
>> - collect-keys
>> - keys2bundle
>> - keys2props
>>
>> (Eclipse uses the terms extract and externalize for this type of
>> refactoring).
>>
>> Parameters:
>>
>> For the file matching parameters, I think it's best to leave out the
>> reference to "rx" and just document in the help that it's a pattern.
>>
>> --property-files : regular expression to match property files (was
>> --rxProperties)
>> --source-files : regular expression to match source files to search for
>> message keys (was --rxSearchFiles)
>>
>> For the key matcher property, I think it makes sense to name it for it's
>> purpose:
>>
>> --key-pattern : regular expression for matching a key in a source file
>> (was --regexp)
>>
>> Here's an example usage w/ the new names:
>>
>> extract-keys --property-files messages_.*.properties --source-files
>> .*.xhtml --key-pattern messages.getMessage\('(.*?)'\)
>>
>> I hope those suggestions are helpful.
>>
>> Cheers,
>>
>> -Dan
>>
>> On Mon, May 7, 2012 at 5:16 PM, Pablo Palazon <pablo.palazon at gmail.com>wrote:
>>
>>> Hi everybody!,
>>>
>>> I'd like to present a plug-in for collect key properties and be added to
>>> properties files (https://github.com/ppalazon/rxlist-forge). Basic,
>>> this plug-in search regular expressions in the content of a group of files,
>>> for example all java source code (*.java).
>>>
>>> I use this plug-in for collect multilingual key used in java and xhtml
>>> code. For example:
>>>
>>> facesmessages.info(messages.getMessage("command.success.message"))
>>>
>>> or
>>>
>>> <h:outputText value="#{messages['person.preffix']}, #{user.lastname}"/>
>>>
>>> Normally, I wrote business code and I don't worry about write this in a
>>> multilingual properties file. Later, I must review all code for collect
>>> used multilingual keys. This is tedious when you have many sources files,
>>> and you have some keys in properties file.
>>>
>>> For install: forge git-plugin git://github.com/ppalazon/rxlist-forge.git
>>>
>>> This plug-in only contains a commands with 3 arguments
>>>
>>> --rxProperties -> regular expression for find properties files
>>> (Messages.*.properties)
>>> --rxSearchFiles -> regular expression for say which files explore
>>> (.*.java, .*.xhtml, etc)
>>> --regexp -> regular expression for describe where is keys
>>> (messages.getMessage\(''(.*?)''\), messages.getMessage\('(.*?)'\))
>>>
>>> Examples:
>>> rxlist --rxProperties messages_.*.properties --rxSearchFiles .*.java
>>> --regexp Componente1.getMessage\(''(.*?)''\) - (I use 2 simple quotes,
>>> don't double quote)
>>> rxlist --rxProperties messages_.*.properties --rxSearchFiles .*.xhtml
>>> --regexp messages.getMessage\('(.*?)'\) - With simple quotes
>>>
>>> All regular expression is based on Java Pattern (
>>> http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html)
>>>
>>> This plugin insert non declared properties keys in properties files, and
>>> insert a default content (founded.key=>>founded.key).
>>>
>>> If you would like to see this in action, there are some test files in
>>> src/test/resources with 2 properties files, 1 java file and 1 xhtml file.
>>> You can open original properties files, and search updated properties files
>>> with test (RegExpListPluginTest) in a generated directory.
>>>
>>> I used this plug-in in a web application, and It's useful when you'd
>>> been used a lot of properties key for multilingual. I'd like to listen you
>>> any suggest, error or improve for this plug-in, or maybe this help you for
>>> create new plug-in for forge. Thanks you so much for this platform, it was
>>> very easy and quick develop this plug-in.
>>>
>>> _______________________________________________
>>> forge-dev mailing list
>>> forge-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>>
>>>
>>
>>
>> --
>> Dan Allen
>> Principal Software Engineer, Red Hat | Author of Seam in Action
>> Registered Linux User #231597
>>
>> http://google.com/profiles/dan.j.allen
>> http://mojavelinux.com
>> http://mojavelinux.com/seaminaction
>>
>>
>> _______________________________________________
>> forge-dev mailing list
>> forge-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20120517/2ac703ea/attachment.html 


More information about the forge-dev mailing list