← Back to team overview

schooltool-developers team mailing list archive

Mixing i18n domains and message factories

 

Hey everybody.

While working in the new CanDo, I've started to pay attention to i18n. Since CanDo depends on multiple packages, I was wondering what you guys think of mixing i18n domains and message factories across the code.

I mean, for example, I know the words/messages "Grade" and "Score" are also present in the gradebook. And we already have several translations for it there. Same with "Done" or "Add" in core, etc.

IMHO, i18n:domains are really easy to combine in ZPT, since you can attach it to one particular tag.

However, it becomes a little more work in Python code, because you need to use message factories, and the '_' shortcut is usually pointing to CanDo's message factory. If I'd like to use the 'Add' translation from core in a CanDo module, I'd need to:

from schooltool.common import SchoolToolMessage
...
button_label = SchoolToolMessage('Add')
...

which looks a bit heavy. I think we could have alternatives, but they would rely on developers knowledge of the current messages, like:

from schooltool.common import SchoolToolMessage as _core
...
button_label = _core('Add')
...

or:

from schooltool.gradebook import GradebookMessage as _gradebook
...
header = _gradebook('Score')
...

and so on. I think the i18n message extractor would ignore those, right?

And maybe we could generate an automatic list of "message id" -> "SchoolTool package" so we all know if a message is available and where it is. It could help us minimize the number of strings to translate.

What do you guys think? Is it worth? Am I making a mountain out of a molehill?

I'd appreciate your feedback on this.

Thanks.

Douglas

"... allí­ es cuando te das cuenta que las cosas malas pueden resultar bastante buenas..." - Lionel Messi

Por favor, evite enviarme adjuntos de Word, Excel o PowerPoint.
Vea http://www.gnu.org/philosophy/no-word-attachments.es.html


Follow ups