(core) Simple localization support and currency selector.

Summary:
- Grist document has a associated "locale" setting that affects how currency is formatted.
- Currency selector for number format.

Test Plan: not done

Reviewers: dsagal

Reviewed By: dsagal

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D2977
This commit is contained in:
George Gevoian
2021-08-26 09:35:11 -07:00
parent e492dfdb22
commit a6e08883e0
36 changed files with 405 additions and 84 deletions

View File

@@ -19,7 +19,10 @@ function CopySelection(tableData, rowIds, fields, options) {
this.colStyle = options.colStyle;
this.columns = fields.map((f, i) => {
let formatter = ValueFormatter.createFormatter(
f.displayColModel().type(), f.widgetOptionsJson());
f.displayColModel().type(),
f.widgetOptionsJson(),
f.documentSettings()
);
let _fmtGetter = tableData.getRowPropFunc(this.displayColIds[i]);
let _rawGetter = tableData.getRowPropFunc(this.colIds[i]);

View File

@@ -158,7 +158,7 @@ export class GristDoc extends DisposableWithEvents {
app.topAppModel.getUntrustedContentOrigin(), this.docComm, app.clientScope);
// Maintain the MetaRowModel for the global document info, including docId and peers.
this.docInfo = this.docModel.docInfo.getRowModel(1);
this.docInfo = this.docModel.docInfoRow;
const defaultViewId = this.docInfo.newDefaultViewId;

View File

@@ -267,7 +267,7 @@ class Searcher {
this._fieldStepper.array = section.viewFields().peek();
this._fieldFormatters = this._fieldStepper.array.map(
f => createFormatter(f.displayColModel().type(), f.widgetOptionsJson()));
f => createFormatter(f.displayColModel().type(), f.widgetOptionsJson(), f.documentSettings()));
return tableModel;
}

View File

@@ -35,7 +35,7 @@ export function addColTypeSuffix(type: string, column: ColumnRec, docModel: DocM
return `${type}:${refTableId}`;
}
case "DateTime":
return 'DateTime:' + docModel.docInfo.getRowModel(1).timezone();
return 'DateTime:' + docModel.docInfoRow.timezone();
default:
return type;
}