We have a great localization infrastructure in place but as it has some limitations it is not practical at all for big texts and as we can see in LDO translatoras cannot keep up with the huge amout of strings produced.

Some of the problems:
- Big texts, like user e-mails or help texts are split into smaller strings. Translators miss context to translate them.
- Translations are keyed by source string, which if is not easy for keeping up with small module strings, it is just painful for bigger texts.
- Using strings themselves as search keys creates a huge burden (both in performance and memory consumption) on the localization system. If we could have less strings and properly keyed by a shorter unique name, it would get better.
- Variables holding some configurable texts (like user e-mails) are just set once and then cannot be translated anymore. Having some mechanism to search texts by name we'd be able to keep these texts out of the variable system.
- As with latest patches we can now also override English texts using the locale system, it should be still easier moving such texts out of variables and having just a hardcoded form and a way to override them using locale but *not variables*

Proposed solution:
- Add some small API, similar to t() / locale() which can handle strings using a unique name (think of it like a variable name). This is introduced in this patch with drupal_text() / locale_text()
- On a second step, we should be replacing all texts stored in variables with these named texts. They can be always overridden using the locale system.
- Third step would be to replace all all multi-line help texts with single big texts keyed by a unique name. Related patches in queue:
#1444980: Add renderable / localizable text element - make modules help text readable and flexible - pluggable localization
#1445144: Build better tokens with parameters (and use them to replace help text)
#517044: Improve text handling, texts in text files (editable, overridable, translatable, etc...) (Needs D8 upgrade)

This patch just provides an example of how the API would look like, it doesn't really do anything yet.

CommentFileSizeAuthor
locale_text.patch5.77 KBJose Reyero
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, locale_text.patch, failed testing.

jair’s picture

Issue tags: +Needs reroll
Jose Reyero’s picture

Status: Needs work » Closed (won't fix)

No need for this anymore, as many of these texts are into the configuration system now, which makes them actually named texts.