Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

feat(examples/formatting): update custom formatter example#781

Merged
kazupon merged 2 commits intokazupon:v8.xfrom
erickwilder:update-messageformat-example
Feb 14, 2020
Merged

feat(examples/formatting): update custom formatter example#781
kazupon merged 2 commits intokazupon:v8.xfrom
erickwilder:update-messageformat-example

Conversation

@erickwilder
Copy link
Copy Markdown
Contributor

Use the new messageformat interface[1] that changes the data type from compiled messageformat
functions to arrays, instead of the old behaviour that converted everything to strings. The old
behaviour of messageformat could not be used without some string manipulation hack to make
component interpolation to work.

This also takes into consideration the simplified interpolation, slot-based interpolation, and
the deprecated place/places interpolation styles.

Other changes

  • Update dependencies; there was a bug in the vue-i18n version that prevented slot-based interpolation
    to correctly pass values to custom formatters.
  • Update all vue-related dependencies to remove compromised packages reported by npm audit

[1] messageformat/messageformat#242


if (values !== null && values !== undefined) {
/**
* Component interpolation in the following format passes `values` as an Array-like `Object`
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an expected behaviour/known issue of vue-i18n or should I report this as a bug?

@erickwilder erickwilder force-pushed the update-messageformat-example branch from bf4fa03 to f3a97e9 Compare February 12, 2020 20:57
@erickwilder erickwilder changed the base branch from v8.x to dev February 12, 2020 21:03
Use the new `messageformat` interface[1] that changes the data type from compiled messageformat
functions to arrays, instead of the old behavior that converted everything to strings. The old
behaviour of `messageformat` could not be used without some string manipulation hack to make
component interpolation to work.

This also takes into consideration the simplified interpolation, slot-based interpolation, and
the _deprecated_ `place`/`places` interpolation styles.

**Other changes**

* Update dependencies; there was a bug in the vue-i18n version that prevented slot-based interpolation
  to correctly pass `values` to custom formatters.
* Update all vue-related dependencies to remove compromised packages reported by `npm audit`

[1]  messageformat/messageformat#242
@erickwilder erickwilder force-pushed the update-messageformat-example branch from 53f42a1 to debb464 Compare February 12, 2020 21:08
@erickwilder
Copy link
Copy Markdown
Contributor Author

e2e tests seem to be failing due to a version mismatch between Chrome/ChromeDriver. I can't see in the CircleCI configuration which version of ChromeDriver is installed but their docs use different methods to install Chrome than what's used in here. If anyone could pick this up or point me in the right path to fix it, I'm glad to help.

@kazupon kazupon changed the base branch from dev to v8.x February 13, 2020 01:43
@kazupon
Copy link
Copy Markdown
Owner

kazupon commented Feb 14, 2020

Thanks!

@kazupon kazupon merged commit a0fc5c2 into kazupon:v8.x Feb 14, 2020
@pr-triage pr-triage bot added the PR: merged label Feb 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants