cordawyn / spira

Fork of Spira with experimental branches, occasionally merged upstream.
http://blog.datagraph.org/2010/05/spira
The Unlicense
8 stars 2 forks source link

Support language tags for literals #15

Open abrisse opened 11 years ago

abrisse commented 11 years ago

See the original thread Support language tags for literals.

I have tried to work on that issue and have push a commit on one of my branches.

Can you read the spec and give me a feedback ? Thanks.

cordawyn commented 11 years ago

Generally your idea looks good. FYI, I went with a "localized string" in my Redlander stack: https://github.com/cordawyn/xml_schema/tree/master/lib/ext

What I don't like is that you made it a "has_many" relation. This design would not be an obvious one for ActiveRecord-renegades, I'm afraid. At least, if we follow the Principle of Least Surprise. I believe that the nuances of internal implementation should not surface in this case: there should be plenty of libraries that rely in the fact that has-many relates to a collection (with the name specified in plural too).

Could you move your code to "property" from "has_many" instead? I expect that there should be many adjustments throughout the code to accommodate for that, though.

abrisse commented 11 years ago

Thanks for the feedback Slava. You are completely right concerning the has_many relation. I have forgotten to modify it, since my previous implementation allowed a user to define multiple labels per language. That explains too the use of select + map in _unserialize_localizedproperties.

I will update my code and will make you a pull request.