Skip to content

Commit

Permalink
Merge branch '2.x' into 2.x-cves
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuali925 authored Oct 15, 2024
2 parents 5c875d4 + 52dbe6e commit 855c8ad
Show file tree
Hide file tree
Showing 179 changed files with 5,684 additions and 1,437 deletions.
1 change: 1 addition & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@ https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
http:/adomas.org/javascript-mouse-wheel/
site.com
http://sites.google.com/site/murmurhash/
helpmenow.com
2 changes: 2 additions & 0 deletions changelogs/fragments/8352.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Add discover summary error info and button click logic enhancement ([#8352](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8352))
6 changes: 6 additions & 0 deletions changelogs/fragments/8504.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
feat:
- Allow hiding the TSVB axis for time series visualizations ([#8504](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8504))
- Allow setting scale of each axis for TSVB time series ([#8504](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8504))

fix:
- Compress non-OUI input fields in TSVB visualizations ([#8504](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8504))
2 changes: 2 additions & 0 deletions changelogs/fragments/8520.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [Workspace]Remove collaborators in workspace creation page ([#8520](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8520))
2 changes: 2 additions & 0 deletions changelogs/fragments/8531.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [Workspace]Display duplicate collaborators error in add collaborators modal ([#8531](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8531))
2 changes: 2 additions & 0 deletions changelogs/fragments/8538.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [Workspace] Add global search bar into left nav ([#8538](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8538))
2 changes: 2 additions & 0 deletions changelogs/fragments/8540.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [Workspace]Replace connections copy with data sources ([#8540](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8540))
2 changes: 2 additions & 0 deletions changelogs/fragments/8541.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- The workspace selector jump that occurs when hovering and clicking. ([#8541](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8541))
2 changes: 2 additions & 0 deletions changelogs/fragments/8544.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Direct query connections fit and finish fixes ([#8544](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8544))
2 changes: 2 additions & 0 deletions changelogs/fragments/8545.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Refactor data source list page to include data source association features for workspace ([#8545](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8545))
2 changes: 2 additions & 0 deletions changelogs/fragments/8554.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Fix new home page small screen display issues ([#8554](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8554))
2 changes: 2 additions & 0 deletions changelogs/fragments/8557.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Add ACL auditor ([#8557](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8557))
2 changes: 2 additions & 0 deletions changelogs/fragments/8564.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chore:
- Update oui to 1.16 ([#8564](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8564))
2 changes: 2 additions & 0 deletions changelogs/fragments/8570.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Fix workspace update issue ([#8570](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8570))
2 changes: 2 additions & 0 deletions changelogs/fragments/8574.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- [Workspace]Show add collaborators modal until collaborators added ([#8574](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8574))
2 changes: 2 additions & 0 deletions changelogs/fragments/8581.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Disable cope all button when there is no saved objects in assets page ([#8581](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8581))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"dependencies": {
"@aws-crypto/client-node": "^3.1.1",
"@elastic/datemath": "5.0.3",
"@elastic/eui": "npm:@opensearch-project/oui@1.15.0",
"@elastic/eui": "npm:@opensearch-project/oui@1.16.0",
"@elastic/good": "^9.0.1-kibana3",
"@elastic/numeral": "npm:@amoo-miki/[email protected]",
"@elastic/request-crypto": "2.0.0",
Expand Down
22 changes: 16 additions & 6 deletions packages/osd-i18n/src/core/i18n.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe('I18n engine', () => {
'en-us'
);

expect(i18n.getLocale()).toBe('en-us');
expect(i18n.getLocale()).toBe('en-US');
expect(i18n.getTranslation()).toEqual({
messages: {
['a.b.c']: 'bar',
Expand Down Expand Up @@ -246,9 +246,19 @@ describe('I18n engine', () => {
expect(i18n.getLocale()).toBe('foo');
});

test('should normalize passed locale', () => {
i18n.setLocale('en-US');
expect(i18n.getLocale()).toBe('en-us');
test('should normalize basic locale', () => {
i18n.setLocale('It-iT');
expect(i18n.getLocale()).toBe('it-IT');
});

test('should normalize simple locale', () => {
i18n.setLocale('en-LATN-us_PRIVATE-variant');
expect(i18n.getLocale()).toBe('en-Latn-US');
});

test('should normalize complex locale', () => {
i18n.setLocale('FR-CA-X-FALLBACK-und-u@keyword=calendarKey');
expect(i18n.getLocale()).toBe('fr-CA');
});
});

Expand Down Expand Up @@ -280,8 +290,8 @@ describe('I18n engine', () => {
});

test('should normalize passed locale', () => {
i18n.setDefaultLocale('en-US');
expect(i18n.getDefaultLocale()).toBe('en-us');
i18n.setDefaultLocale('eN-uS');
expect(i18n.getDefaultLocale()).toBe('en-US');
});

test('should set "en" locale as default for IntlMessageFormat and IntlRelativeFormat', () => {
Expand Down
22 changes: 20 additions & 2 deletions packages/osd-i18n/src/core/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ const EN_LOCALE = 'en';
const translationsForLocale: Record<string, Translation> = {};
const getMessageFormat = memoizeIntlConstructor(IntlMessageFormat);

/* A locale code is made of several components:
* * lang: The two- and three-letter lower-case language code follows the ISO 639-1 and ISO 639-2/3 standards, respectively.
* * script: The optional four-letter title-case code follows the ISO 15924 standard for representing writing systems.
* * region: The two-letter upper-case region code follows the ISO 3166-1 alpha-2 standard.
*
* Ref: https://www.rfc-editor.org/rfc/rfc5646.txt
* Note: While case carries no distinction with locale codes, proper formatting is recommended.
*/
const localeParser = /^(?<lang>[a-z]{2,3})(?:-(?<script>[a-z]{4}))?(?:-(?<region>[a-z]{2}|[0-9]{3}))?(?:[_@\-].*)?$/i;

let defaultLocale = EN_LOCALE;
let currentLocale = EN_LOCALE;
let formats = EN_FORMATS;
Expand All @@ -64,8 +74,16 @@ function getMessageById(id: string): string | undefined {
* Normalizes locale to make it consistent with IntlMessageFormat locales
* @param locale
*/
function normalizeLocale(locale: string) {
return locale.toLowerCase();
export function normalizeLocale(locale: string) {
const { lang, script, region } = localeParser.exec(locale)?.groups || {};
// If parsing failed or the language code was not extracted, return the locale
if (!lang) return locale;

const parts = [lang.toLowerCase()];
if (script) parts.push(script[0].toUpperCase() + script.slice(1).toLowerCase());
if (region) parts.push(region.toUpperCase());

return parts.join('-');
}

/**
Expand Down
Loading

0 comments on commit 855c8ad

Please sign in to comment.