Needs review
Project:
modr8
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Oct 2009 at 21:05 UTC
Updated:
2 Apr 2010 at 03:17 UTC
Add i18n support to allow node type information to be translated.
| Comment | File | Size | Author |
|---|---|---|---|
| modr8_i18n.patch | 2.08 KB | aufumy |
Comments
Comment #1
pwolanin commentedIs this module standard? Woudl I not just use t()?
Comment #2
aufumy commentedPeter, at this point, afaik, I cannot find a comprehensive methodology. The most well defined is by nedjo as he outlined here:
http://drupal.org/node/304002
There seems to have been consensus or common knowledge at one point by a few core developers, to not use t() for any text not written in code. That might have been sufficient in earlier drupal versions where there was either text in code, or user input text. Thus this excerpt from common.inc:
At this point, though with the abundance of admin defined 'user input' strings, such as the names of content types, it doesn't quite fit into the category of 'user input' strings.
I would love to see the tt() function in core at some point, so that each module does not have to define its own tt()
I have submitted similar patches to a bunch of modules, and one of the patches which have been committed is by Jose Reyero, and he added a book page as well:
http://drupal.org/node/609364
Comment #3
pwolanin commentedWould it not be more generic to write this as:
or even:
Comment #4
aufumy commentedI had a sort of similar idea in the user relationships issue http://drupal.org/node/471546
however after discussion with Kars-T in the issue, and Scott Reynolds on IRC, Scott explained to me, that my methodology might not be secure, as each module might implement the above code, and if another module implemented an insecure or poorly written tt(), all modules calling tt() would suffer.
Your code looks better, but it also does not guarantee that the tt() function comes from i18nstrings, and may have been defined by another module.
Now the chances of that happening may be small and insignificant, especially for developers like us who are in control of the code, but I'm just throwing stuff out there.
Audrey
Comment #5
pwolanin commentedLook, if I can get you to install my evil.module I don't need tt(), I can just drop all your tables on hook_init() or hook_exit() or whatever is called on every page.
drupal core does it in ^ for drupal_mail_wrapper() I think.
Anyhow - it allows you to have varied tt() implementations if you really need to.
Comment #6
aufumy commentedtrue, look, I really don't know what is the best way.
Whatever, is done on the contrib module level will be not as clean, because this should really be in core. Also, this should really be discussed on a wider scale.
I know that whatever you choose to do will be more than fine and excellent.
Comment #7
pwolanin commentedrelated: #685220: E-mail subjects translation