Skip to content

Support html tags in i18n component #795

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

Merged
merged 10 commits into from
Oct 21, 2022
Merged

Support html tags in i18n component #795

merged 10 commits into from
Oct 21, 2022

Conversation

Demivan
Copy link
Member

@Demivan Demivan commented Oct 21, 2022

Description

Add boolean prop html to i18n component. Setting it to true will allow using html markup in translations.

Linked Issues

Fixes #760

Additional context

New configuration added to createFluentVue - parseMarkup function. This allows changing parse function for environments where DOMParser is not available.

Default implementation is:

function defaultMarkupParser(value: string) {
  const parser = new DOMParser()
  const doc = parser.parseFromString(value, 'text/html')
  const nodes = Array.from(doc.body.childNodes)

  return nodes
}

@Demivan Demivan added the Type: Feature Includes new features label Oct 21, 2022
@Demivan Demivan self-assigned this Oct 21, 2022
@github-actions
Copy link

github-actions bot commented Oct 21, 2022

Export Size

fluent-vue

Name Size Diff
createFluentVue 2.18 KB +329 B (+17.24%) 🔺
useFluent 887 B +2 B (+0.23%) 🔺

@codecov
Copy link

codecov bot commented Oct 21, 2022

Codecov Report

Merging #795 (d224e99) into main (d224e99) will not change coverage.
The diff coverage is n/a.

❗ Current head d224e99 differs from pull request most recent head 3bce72e. Consider uploading reports for the commit 3bce72e to get more accurate results

@@            Coverage Diff            @@
##              main      #795   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           11        11           
  Lines          168       168           
  Branches        29        29           
=========================================
  Hits           168       168           
Flag Coverage Δ
vue-2 91.66% <0.00%> (ø)
vue-3 91.66% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Demivan Demivan merged commit 043288e into main Oct 21, 2022
@Demivan Demivan deleted the html-in-component branch December 5, 2022 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Includes new features
Development

Successfully merging this pull request may close these issues.

html tags in i18n component
1 participant