Releases: utopia-php/locale
Releases · utopia-php/locale
0.8.0
0.7.0
What's Changed
- Added CONTRIBUTING.md to locale by @Lakshay-Pruthi in #8
- doc: Add code_of_conduct.md file by @srijit2002 in #7
- Upgrades issue templates to use GitHub issue forms ✍️ by @drph4nt0m in #5
- Added code linter by @Rajat379 in #13
- Update Authors in ‘utopia-php/locale’ by @rohitkori in #14
- Add PHPStan analysis and update code to match the requirements by @ks129 in #15
- feat: Test Workflow by @2002Bishwajeet in #16
- Feat: getLanguages(), getTranslations() methods by @Meldiron in #12
- Feat fallback locale by @Meldiron in #17
New Contributors
- @Lakshay-Pruthi made their first contribution in #8
- @srijit2002 made their first contribution in #7
- @drph4nt0m made their first contribution in #5
- @Rajat379 made their first contribution in #13
- @rohitkori made their first contribution in #14
- @ks129 made their first contribution in #15
- @2002Bishwajeet made their first contribution in #16
Full Changelog: 0.6.0...0.7.0
0.6.0
- We adjusted the second parameter of
getText-$placeholdersfor achieving more consistency and better support from localizing software. Before, you used your placeholder likeHello {name}, now it'sHello {{name}}. More examples:
// BEFORE.json
{
'age: 'You are {age} years old',
'fullName': 'You are logged in as {name} {surname}.',
'post-info': 'Your post has {likeAmount} likes and {commentAmount} comments.'
}// AFTER.json
{
'age: 'You are {{age}} years old',
'fullName': 'You are logged in as {{name} {{surname}}.',
'post-info': 'Your post has {{likeAmount}} likes and {{commentAmount}} comments.'
}0.5.0
- We removed second parameter
$default. To achieve the same logic, you can do this in your code:
$translation = $locale->getText('myMissingTranslation');
if($translation == '{{myMissingTranslation}}') {
$translation = 'Translation not found!';
}
echo $translation;If you have exceptions enabled, you could:
Locale::$exceptions = true;
try {
$translation = $locale->getText('myMissingTranslation');
echo $translation;
} catch (\Throwable $exception) {
echo "Translation not found!";
}- We added new second parameter
$placeholders. Please refer to README.md to learn how to use it.