(core) Extending default locale list

Summary: Adding more locale codes to support more countries in document settings

Test Plan: existing tests

Reviewers: dsagal

Reviewed By: dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3018
This commit is contained in:
Jarosław Sadziński
2021-09-23 20:09:58 +02:00
parent 52fd28815e
commit 048c8ee165
6 changed files with 240 additions and 25 deletions

View File

@@ -487,6 +487,15 @@ export function nativeCompare<T>(a: T, b: T): number {
return (a < b ? -1 : (a > b ? 1 : 0));
}
/**
* Creates a function that compares objects by a property value.
*/
export function propertyCompare<T>(property: keyof T) {
return function(a: T, b: T) {
return nativeCompare(a[property], b[property]);
};
}
// TODO: In the future, locale should be a value associated with the document or the user.
export const defaultLocale = 'en-US';
export const defaultCollator = new Intl.Collator(defaultLocale);