php - Best way to organize your localized translation file -
as i've started building project, there quite few entries in .po translation file. use poedit build these.
my question is, best practice entries within file? thinking, instead of referencing entries such as:
echo _('this entry.'); i thinking of organizing them like:
echo _('error_pwd'); echo _('error_user_taken'); which, once ran through translation file, output like:
password incorrect. please try again. username taken. please try another. so, translations can organized type, such error_, msg_, status_, tip_, etc.
has seen done way, or have suggestions on more organized method?
in fact doesn't matter!
it's you.
however, advise not split translations in sections. no there's benefit in doing so. actually, projects use 1 file approach msgid entries. django, see.
of course, if still want split translation sections, might want take on domains:
from php doc:
this function (textdomain()) sets domain search within when calls made gettext(), named after application.
also, earlier said, advantage when using msgid real phrase ou word (instead underline or dotted notation key) stays default message if no there's translation entry.
and here goes helpful links:
Comments
Post a Comment