rdio / vernacular

MIT License
170 stars 42 forks source link

Support specific field assignment extraction #33

Open gluck opened 11 years ago

gluck commented 11 years ago

I'm considering Vernacular to add localization support to our (Winforms) solution. Using Catalog.get* is easy enough, but I'm wondering if it could be further simplified for developpers, by automagically extracting some fields assignments.

For instance every assignment to Control::Text property to a string constant could be extracted. Further down we could extract all string properties which have the attribute [Localizable(true)] (like the VS designer is doing when enabling Localizable).

If I write control.Text = "Foo", processing the assembly through Vernacular would also replace this by control.Text = Catalog.getString("Foo").

Any thoughts on this ?

benjamin-bader commented 11 years ago

It's certainly feasible to do this. Take a look at AssemblyParser.cs, which is what examines DLLs for Catalog.Get* calls; it will provide a good jumping-off point. If implemented, this should take the form of a separate Parser.

As for the desirability of this feature, I personally feel that the value added by the Catalog abstraction outweighs the burden of using it. That said, I wouldn't be opposed to a good patch.

gluck commented 11 years ago

Thanks for the pointers, I was considering to make the change, but I prefer short-lived forks pulled upstream. I'll let you know when/if/how I move forward on this.