Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 3, 2021

Conversation

spras
Copy link
Contributor

@spras spras commented Jan 12, 2021

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
Copy link
Contributor

stof commented Jan 12, 2021

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

@spras
Copy link
Contributor Author

spras commented Jan 12, 2021

Fix #315

@spras
Copy link
Contributor Author

spras commented Jan 12, 2021

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 spras changed the title Fix get_message on intl_icu if domain is undefined Fix : When domain is not defined, get_message find translations in intl-icu format but don't format it correctly Jan 13, 2021
@spras
Copy link
Contributor Author

spras commented Jan 13, 2021

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
Copy link
Collaborator

monteiro commented Jul 3, 2021

Thanks @spras ,
Looks good to me.

@monteiro monteiro self-requested a review July 3, 2021 14:45
@monteiro monteiro merged commit d9bc690 into willdurand:master Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants