On 02/20/2012 05:50 PM, Jason Guiditta wrote:
Hello list, I was just looking at seeds.rb to see about extracting our role names into i18n files so we can leverage the configuration I added there last week, and noticed what seems to me to be a minor inconsistency. Disregarding role with the name 'Administrator', it seems most of our roles are named: "{object name} user" or "{object name} owner"
There are 2 exceptions I see to this - the Instance and Deployment objects. These both use 'Controller' instead of 'User'.
I would like to propose making those consistent as part of the patch I am working on, unless there is some reason they are like this of which I am unaware. Thoughts?
-j
I think that, historically, we gave those different names because they contained a different combination of privileges from the 'User' roles. However, now that some roles contain privileges from multiple levels (Pool admin has pool and instance privileges, etc) the distinction is no longer so relevant.
To clarify, your intent here is not to substitute the i18n strings when processing seeds.rb, but to actually put the i18-ready strings in the database, is this correct? i.e. instead of "Pool Administrator" the string in the db would have 't("obj_types.pool") t("roles.administrator")' -- or something like that? That way we'll be properly translating roles for the user's locale. Also, although the current set of role names fits nicely with "<foo> User" and "<foo> Administrator", it's not safe to assume this will always be the case. However, if what you're doing is just putting a string to be globalized into the db, that would work for more specific one-off roles that didn't fit this scheme so well.
On the other hand, having a separate string for each role name might be better in that it avoids the problem of word order being different depending on locale --i.e. "obj-type role-type" may be the correct order in english but perhaps not in all languages. You'd avoid this problem if you used t("roles.names.provider_administrator"), etc.
Scott