zxcvbn-php
zxcvbn-php copied to clipboard
Use gettext for translation support and add french translation
Hello,
I'm currently working on French support and this second PR add gettext
usage to allow warning and suggestion messages translation. My modifications:
- use
dgettext()
to translate warning and suggestion messages from custom text domainZxcvbnPhp
. Note:TimeEstimator::displayTime()
method was simplified usingdngettext()
that handle plural forms. - Add
Locales
directory to store translation stuff - Bind
ZxcvbnPhp
text domain toLocales
directory inZxcvbn
class constructor - Add
extract_messages.sh
script that handle messages extractions usingxgettext
and generate/updateLocales/zxcvbn-php.pot
file - Add french translation in
Locales/fr_FR.UTF8
directory
This solution permit to easily integrate this library in PHP application that already use gettext for translation. Other applications just have to set locale by setting LANGUAGE
environment variable or using setlocale()
function.
Hello, I rebased my commits on your master branch. I still hope this PR could be merge upstream :)