Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

feat(conditionalIntl): added env var for Itnl #1258

Merged

Conversation

timBarton96
Copy link
Member

Description

Added an environment variable to conditionally add the lean-intl polyfill.

Motivation and Context

The lean-intl polyfill is missing Intl fetres and this PR is for consumers of one-app that want to trade compatibility with older browsers for these Intl features. The environment variable defaults to enable lean-intl polyfill, so needs to be explicitly be disabled. By disalbing the polyfill, the Intl implementations of the browsers are used and for modern browsers, this means extended functionality.

How Has This Been Tested?

I served a test-module which uses Luxon which uses Intl for its timezones functionality. The timezones would not work without the env var, but when the env var is enabled and there is no lean-intl the timezones work.

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (adding or updating documentation)
  • Dependency update
  • Security update

Checklist:

  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • These changes should be applied to a maintenance branch.
  • This change requires cross browser checks.
  • Performance tests should be ran against the server prior to merging.
  • This change impacts caching for client browsers.
  • This change impacts HTTP headers.
  • This change adds additional environment variable requirements for One App users.
  • I have added the Apache 2.0 license header to any new files created.

What is the Impact to Developers Using One App?

Developers will now have the option to opt out of using lean-intl.

Copy link
Member

@10xLaCroixDrinker 10xLaCroixDrinker left a comment

Choose a reason for hiding this comment

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

This also requires changes to one-app-ducks to prevent loading intl polyfill locale packs when using native Intl https://github.com/americanexpress/one-app-ducks/blob/main/src/intl/index.js#L436

src/server/plugins/reactHtml/index.jsx Show resolved Hide resolved
src/server/polyfill/intl.js Outdated Show resolved Hide resolved
Matthew-Mallimo
Matthew-Mallimo previously approved these changes Feb 5, 2024
@Matthew-Mallimo
Copy link
Member

@timBarton96 one-app-ducks@4.5.0 has been released. Please include this upgrade in this PR!

Matthew-Mallimo
Matthew-Mallimo previously approved these changes Mar 6, 2024
Matthew-Mallimo
Matthew-Mallimo previously approved these changes Mar 6, 2024
@10xLaCroixDrinker 10xLaCroixDrinker enabled auto-merge (squash) March 6, 2024 18:12
auto-merge was automatically disabled March 8, 2024 09:27

Head branch was pushed to by a user without write access

@code-forger code-forger force-pushed the feat/conditionalIntlPolyfill branch from 808d2ec to a5a231b Compare March 26, 2024 14:31
@code-forger code-forger merged commit 7b65266 into americanexpress:main Mar 26, 2024
8 checks passed
@@ -236,6 +240,12 @@ export function getHead({
`;
}

export function renderEnvironmentVariables(nonce) {
Copy link
Contributor

Choose a reason for hiding this comment

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

just a naming nitpick, renderEnvironmentVariables indicates that its a standard practice to include, right now this is okay but could lead to issues in the future

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants