php - Localizing sentences -


i'm localizing php project gettext ... no problem part. thing that, example, have sentence "remember password". can put in code next (to use gettext) : echo _("remember password")

that generate line in po file key "remember password", , translate in english file "remember password", , in spanish site "recordar password" in mo files.

if in future, want change sentence , put in english "remember password forever" (for example again) ... issue key "sentence" different english translation.

two possible situations:

1) so, if want have clean, change key again, , change php code again, not useful.

2) in other hand, use generic key, "login page - remember", can used , serves future different sentences. extends time of "localizing", since it's not fast adding _(" , ")

what use ? other 3rd option ?

thank comments

you pretty have summed 2 options have. keep in mind if sentence changes in original language, it'll change in localized version well, you'd have touch occurrences of anyway (except typos, don't make any).

a strategy may keep primary language in php files during heavy development, since it's expected change often. once app settles down somewhat, can extract po file , replace strings in php generic placeholders. whether works or not depends on workflow , size of project.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -