Since the custom title is passed as argument to t(), but t() itself uses '@title', the custom title cannot be translated.
| Comment | File | Size | Author |
|---|---|---|---|
| better_formats-DRUPAL-6--1.custom-title.patch | 773 bytes | sun |
Since the custom title is passed as argument to t(), but t() itself uses '@title', the custom title cannot be translated.
| Comment | File | Size | Author |
|---|---|---|---|
| better_formats-DRUPAL-6--1.custom-title.patch | 773 bytes | sun |
Comments
Comment #1
dragonwize commentedI am not overly familiar with the translation system but this is what I was going for, can you tell me if this will work?
The core string is "Input format" and should be translated in core language files. If the user does not use the custom title feature it would be nice to just let it be translated as normal.
Would this patch achieve that goal?
Or would this be better
Comment #2
sunAlmost - that's what the patch is doing; it either passes the custom string or "Input format" to t(), and t() will translate the string into the locale/language of the current request.
Comment #3
gábor hojtsyThe Drupal i18n_strings.module defines a tt() function, which can be used for user input translation. It also uses all this to translate menus, taxonomies, etc. which Drupal otherwise cannot translate.
Drupal core does not provide any way whatsoever to translate user input, and t() should not be used for that as it is already documented.
Comment #4
dragonwize commentedSo this would be an appropriate solution?
Comment #5
dragonwize commentedComment #6
sunNot to mention that there are several other modules in contrib that provide multi-language solutions for Drupal. i18n_strings depends on i18n module and is yet considered experimental. For Drupal 6, contrib modules cannot and should not assume that i18n is used for multilingual sites.
Also, one does not need a multilingual solution like i18n for localizing the UI only, which is a perfectly valid use-case. The string in question is a short, administratively defined string used to override a form element label of Drupal core.
Putting this in a bold formatting does not change the fact that there are no viable options for contrib modules in Drupal 6 other than t().
Having this warning in the docs for t() is good, as it prevents developers from abusing t() for localizing often-changing, user-defined strings.
Comment #7
dragonwize commentedComment #8
markus_petrux commentedSorry to re-open, but...
I think the module name is "i18nstrings", not "i18n_strings", at least these days.
And... tt() has been replaced by i18nstrings() in latest -dev version of i18n.
Comment #9
dragonwize commentedI've committed the change to the 2.x branch. Thank you markus_petrux.