Skip to content

Commit

Permalink
Merge branch 'spatie:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
thaqebon authored Jan 31, 2025
2 parents 099a209 + 0653875 commit ccb707f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.2.0
uses: dependabot/fetch-metadata@v2.3.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
compat-lookup: true
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

All notable changes to `laravel-translatable` will be documented in this file

## 6.10.1 - 2025-01-31

### What's Changed

* Handle null database values as null in translations by @alipadron in https://github.com/spatie/laravel-translatable/pull/479

**Full Changelog**: https://github.com/spatie/laravel-translatable/compare/6.10.0...6.10.1

## 6.10.0 - 2025-01-31

### What's Changed

* Support clearing translations using an empty array by @alipadron in https://github.com/spatie/laravel-translatable/pull/478
* Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0 by @dependabot in https://github.com/spatie/laravel-translatable/pull/484
* Add support for nested key translations by @thaqebon in https://github.com/spatie/laravel-translatable/pull/483

### New Contributors

* @thaqebon made their first contribution in https://github.com/spatie/laravel-translatable/pull/483

**Full Changelog**: https://github.com/spatie/laravel-translatable/compare/6.9.3...6.10.0

## 6.9.3 - 2024-12-16

### What's Changed
Expand Down
2 changes: 1 addition & 1 deletion src/HasTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function getTranslation(string $key, string $locale, bool $useFallbackLoc

$translations = $this->getTranslations($key);

$translation = $translations[$normalizedLocale] ?? '';
$translation = is_null(self::getAttributeFromArray($key)) ? null : $translations[$normalizedLocale] ?? '';

$translatableConfig = app(Translatable::class);

Expand Down
4 changes: 2 additions & 2 deletions tests/TranslatableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ public function setAttributesExternally(array $attributes)
[['en' => 'english', 'nl' => 'dutch'], ['en', 'nl'], ['english', 'dutch']],
]);

it('should return empty string when the underlying attribute in database is null', function () {
it('should return null when the underlying attribute in database is null', function () {
// we need to remove the name attribute from the translatable array
// and add it back to make sure the name
// attribute is holding `null` raw value
Expand All @@ -864,7 +864,7 @@ public function setAttributesExternally(array $attributes)

$translation = $this->testModel->getTranslation('name', 'en');

expect($translation)->toBe('');
expect($translation)->toBeNull();
});

it('should return locales with empty string translations when allowEmptyStringForTranslation is true', function () {
Expand Down

0 comments on commit ccb707f

Please sign in to comment.