willdurand / BazingaJsTranslationBundle

A pretty nice way to expose your Symfony translation messages to your client applications.
MIT License
572 stars 178 forks source link

Fix : When domain is not defined, get_message find translations in intl-icu format but don't format it correctly #314

Closed spras closed 3 years ago

spras commented 3 years ago

Given the following translations file:

# translations/messages+intl-icu.en.yaml hello_name: Hello {name}!

When domain is not defined, get_message find the translation in intl-icu format, but it don't format it correctly.

Translator.trans('hello_name', { name: 'John' })

give

Hello {name}!

it should give

Hello John!

stof commented 3 years ago

the fix is incomplete as it does not apply the suffix in has_message checks

spras commented 3 years ago

Fix #315

spras commented 3 years ago

the fix is incomplete as it does not apply the suffix in has_message checks

@stof : the suffix is applied just after, line 301 https://github.com/willdurand/BazingaJsTranslationBundle/pull/314/files#diff-9608ce90f4a6423da5d94bd649469c278db7dba58fee60bf7654afb1c3451e4fR301

When the trad was found in an intl-icu domain line 294, for example messages+intl-icu , then it was searched with twice the suffix : messages+intl-icu+intl-icu , not found

spras commented 3 years ago

Sorry, my initial description of the issue, and my last comment were not clear enough. The get_message found the translation, but it didn't apply the correct format. I added some tests cases.

monteiro commented 3 years ago

Thanks @spras , Looks good to me.