mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
5219932a1f
Summary: Adding initial work for localization support. Summary in https://grist.quip.com/OtZKA6RHdQ6T/Internationalization-and-Localization Test Plan: Not yet Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D3633
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import {get as getBrowserGlobals} from 'app/client/lib/browserGlobals';
|
|
import {setupLocale} from 'app/client/lib/localization';
|
|
import {AppModel, TopAppModelImpl} from 'app/client/models/AppModel';
|
|
import {setUpErrorHandling} from 'app/client/models/errors';
|
|
import {buildSnackbarDom} from 'app/client/ui/NotifyUI';
|
|
import {addViewportTag} from 'app/client/ui/viewport';
|
|
import {attachCssRootVars} from 'app/client/ui2018/cssVars';
|
|
import {BaseAPI} from 'app/common/BaseAPI';
|
|
import {dom, DomContents} from 'grainjs';
|
|
|
|
const G = getBrowserGlobals('document', 'window');
|
|
|
|
/**
|
|
* Sets up error handling and global styles, and replaces the DOM body with
|
|
* the result of calling `buildPage`.
|
|
*/
|
|
export function setupPage(buildPage: (appModel: AppModel) => DomContents) {
|
|
setUpErrorHandling();
|
|
const topAppModel = TopAppModelImpl.create(null, {});
|
|
attachCssRootVars(topAppModel.productFlavor);
|
|
addViewportTag();
|
|
|
|
void setupLocale();
|
|
|
|
// Add globals needed by test utils.
|
|
G.window.gristApp = {
|
|
testNumPendingApiRequests: () => BaseAPI.numPendingRequests(),
|
|
};
|
|
|
|
dom.update(document.body, dom.maybe(topAppModel.appObs, (appModel) => [
|
|
buildPage(appModel),
|
|
buildSnackbarDom(appModel.notifier, appModel),
|
|
]));
|
|
}
|