Remove t() from all schema descriptions
webchick - November 9, 2008 - 16:21
| Project: | Drupal |
| Version: | 6.x-dev |
| Component: | database system |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
| Issue tags: | Needs Documentation, Quick fix |
Description
Split off from http://drupal.org/node/329998#comment-1099076.
In Szeged, we had a big long discussion about t() around the schema descriptions and it was the consensus of everyone at the table (who included Dries) that t()s should be removed from these descriptions. They mess up things because t() isn't available that early, and people discussed that no one is going to take the time to translate technical descriptions of stuff, and it doesn't really make sense since we also don't translate code comments, for example.
Hopefully someone can script this up so it's not too horrible. :)

#1
It should be clean.
#2
replace also multiline (in simpletest.install) :
'description' => t('Primary Key: Unique simpletest ID used to group test results together. Each time a set of testsare run a new test ID is used.'),
#3
Errors in color.install - where t() shouldn't be removed , this is for the requirements, nothing todo with schema iirc
#4
undo color.install.
#5
Undo two wrong replacements in book.install and forum.install.
#6
while we're at it, php install and color install use t() but they should rather use $t = get_t() like other modules do I think. Can someone else confirm that ?
#7
The last submitted patch failed testing.
#8
Reroll.
#9
Looks good. Committed to CVS HEAD. We should document this on the module upgrade page. After it has been documented, please mark this 'fixed'. Thanks!
#10
I haven't permission for edit page http://drupal.org/node/224333.
Schema descriptions are no longer translated
(Issue) To reduce the strings to translate, descriptions of the schema database (tables and fields) in module.install no longer need to be translated.
6.x:
<?phpfunction forum_schema() {
$schema['forum'] = array(
'description' => t('Stores the relationship of nodes to forum terms.'),
'fields' => array(
'nid' => array(
'description' => t('The {node}.nid of the node.'),
),
),
);
return $schema;
}
?>
7.x:
<?phpfunction forum_schema() {
$schema['forum'] = array(
'description' => 'Stores the relationship of nodes to forum terms.',
'fields' => array(
'nid' => array(
'description' => 'The {node}.nid of the node.',
),
),
);
return $schema;
}
?>
#11
@lilou: that horrible bug has now been fixed. Welcome to the documentation team. ;) Please feel free to add in your edits, which look great.
#12
Thx.
#13
block.install still needs some love - Let's look at others too. Noticed this thanks to #337794: PostgreSQL surge #1: make simpletest works again
#14
You're right.
#15
Thanks; committed!
#16
Actually the schema descriptions are all translated for D6, and also translated for contributed modules (which are translated already).
I agree, that translating these strings is meaningless. My question (1) is can I file issues for D6 contributed modules to remove t() from schema descriptions? That would make module translation much more easier, and if we translate D6 modules, then removing this option in D7 just does not seem right.
And also (2) can I file an issue for potx module, to not extract scheme descriptions from D6 and D6 modules?
#17
answer on (2) #338409: Do not extract schema descriptions
#18
so, it seems like we will have to backport this patch to D6 (read the potx issue)
#19
I can only guess how many hours I've spend on the German translation of schema translation in D& and now all this translations are going to be lost.
#20
I've translated most of the Hungarian schema strings just to see that the translation is 100%, not to say that it will be ever read, or that it would not go against storing the descriptions in the database as table comments. I am in support of a backport.
#21
Summarizing reasons to remove t() for hass, since he does not yet get it (see http://drupal.org/node/338409#comment-1131476):
- the functionality behind t() is not available when the schema hooks are invoked in the installer, up until locale module is enabled, so the t() calls always return the same string in installation time
- this text is documenting the code, and therefore is similar to code comments, which are not translated either
- this is technical text, and many of the translation teams such as the Hungarian team translates it just to see 100% completed translations, not because it will ever show on the interface
- if t() is not used on these strings, Drupal can actually add the descriptions to the tables and fields themselves in the database (for those backends where this is supported, for example MySQL - http://dev.mysql.com/doc/refman/5.1/en/create-table.html), so more powerful database tools can operate with those, show and help database admins to work with the tables
#22
You missed to say that Schema module shows the translated strings in UI.
#23
It does not need to.
#24
Schema field descriptions possible used in views, isn't it?
If no, suppose, t() for schema in 6x is useless.
#25
Another opinions to remove t()
- less runtime memory usage
- faster serialize|unserialize for locale cache
because most of descriptions less then 75 chars so they stored in locale cache but useless in production env
#26
Every *.install in modules checked and cleared hook_schema t()
#27
Chasing 6-dev
#28
Code applies cleanly, Codewise also good and tested on dev machine with all core modules enabled.
#29
Committed to Drupal 6, thanks!
Also updated docs at http://drupal.org/node/322731 to say:
#30
Yay! This was really frustrating to translate.
#31
Automatically closed -- issue fixed for two weeks with no activity.
#32
We need to update more documentation on this. All the examples of hook_schema still include this code.
http://api.drupal.org/api/function/hook_schema
http://drupal.org/node/146843
#33
I changed http://drupal.org/node/146862 - didn't find any other examples of descriptions in that section of the handbook.
http://api.drupal.org/api/function/hook_schema is still wrong, including the D7 version
#34
Could we get this committed to HEAD? Then we can do the same to the D6 version (which is still in contrib, so I can get it).
#35
Committed. Thanks!
#36
Or, well.
#37
Fixed in D6 http://drupal.org/cvs?commit=214280
Thanks webchick!
#38
Automatically closed -- issue fixed for 2 weeks with no activity.