Skip to content

Empty translation strings return the key #34218

Closed
@brendt

Description

@brendt
  • Laravel Version: 8.0
  • PHP Version: 7.4

Description:

I believe that due to a recent change in \Illuminate\Translation\Translator, empty translation keys now also result in the translation key being show, instead of just the empty string.

This commit added an empty check: 02e983e

empty return true when a string is empty, but an empty translation is a valid one. I believe isset should be used.

Steps To Reproduce:

Here's a simple test case taken from https://github.com/spatie/laravel-translation-loader/blob/master/tests/DummyManagerTest.php

    /** @test */
    public function it_can_translate_using_dummy_manager_using_empty_translation_in_db()
    {
        $this->createLanguageLine('file', 'key', ['en' => '']);
        $this->assertSame('', trans('file.key'));
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions