Skip to content

Releases: utopia-php/locale

0.6.0

20 Sep 06:01
9de0523
Compare
Choose a tag to compare
0.6.0 Pre-release
Pre-release

⚠️ This release includes breaking changes! ⚠️

  • We adjusted the second parameter of getText - $placeholders for achieving more consistency and better support from localizing software. Before, you used your placeholder like Hello {name}, now it's Hello {{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

13 Sep 09:43
a8c0375
Compare
Choose a tag to compare
0.5.0 Pre-release
Pre-release

⚠️ This release includes breaking changes! ⚠️

  • 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.

0.4.0

24 Jul 11:36
c2d9358
Compare
Choose a tag to compare
0.4.0 Pre-release
Pre-release
  • Added new method to set locale from JSON file alongside a native assoc array.

0.3.3

24 Oct 08:15
Compare
Choose a tag to compare
0.3.3 Pre-release
Pre-release

Updated tests, CI, coding standard and added some minor fixes based on Psalm analysis.

0.3.2

29 Jun 20:53
Compare
Choose a tag to compare
0.3.2 Pre-release
Pre-release

Fixed bug

0.3.1

29 Jun 20:51
Compare
Choose a tag to compare
0.3.1 Pre-release
Pre-release
Updated type

0.3.0

29 Jun 12:44
Compare
Choose a tag to compare
0.3.0 Pre-release
Pre-release

Added option to create an object instance, and added type hints.

0.2.1

20 Jun 11:59
Compare
Choose a tag to compare
0.2.1 Pre-release
Pre-release

Optimized PHP performance by using fully-qualified function calls.

0.1.0

28 Apr 21:43
Compare
Choose a tag to compare
0.1.0 Pre-release
Pre-release
Optimizing PHP performance by using

fully-qualified function calls

0.2.0

24 Mar 18:04
e3e5f16
Compare
Choose a tag to compare
0.2.0 Pre-release
Pre-release
Update .travis.yml