cakephp - Internationalization - how to handle gender? -


i have cakephp 3 application i'm internationalizing. app written in french, i'm adding english.

i'm using built in tools of cakephp 3 it. there sentence in app must translated differently in english whether user man or woman. in french, sentence remains same.

french sentence: "xxx n'a pas indiqué ses disponibilités"

english translation: "xxx did not give availabilities" man, "xxx give availabilities" woman.

at first, app looked this:

<?= __("{0} n'a pas indiqué ses disponibilités", $user->name); ?> 

i changed 2 different translations provided:

<?php if ($user->gender == 'm'): ?> <?= __("{0} n'a pas indiqué ses disponibilités", $user->name); ?> <?php else: ?> <?= __("{0} n'a pas indiqué ses disponibilités", $user->name); ?> <?php endif; ?> 

but when generating pot file bin/cake i18n extract 1 sentence extracted. i've tried this:

<?php if ($user->gender == 'm'): ?> <?= __x("speaking of man", "{0} n'a pas indiqué ses disponibilités", $user->name); ?> <?php else: ?> <?= __x("speaking of woman", "{0} n'a pas indiqué ses disponibilités", $user->name); ?> <?php endif; ?> 

still, 1 msgid recorded in pot file. how handle kind of issue?

using context translation function way go, last example correct way of handling such cases.

the problem i18n shells extract task, uses message identifier store extracted values, resulting in previous contexts overwritten. consider bug, please report on @ github.

until fixed you'll have manually add missing messages .pot file.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -