This repository was archived by the owner on Sep 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathstrings.ts
More file actions
47 lines (43 loc) · 1.99 KB
/
strings.ts
File metadata and controls
47 lines (43 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
export class Strings {
private static overrides: {} | undefined;
private static defaults: {} = {
'Shared': 'Shared',
'Error.4XX': 'You no longer have access to this notebook.',
'Error.5XX': 'Something went wrong on our end.',
'Error.Fallback': 'Something went wrong.',
'Error.ValidateNotebookName.EmptyNotebookNameMessage': 'Notebook name must contain a value and cannot be whitespaces only.',
'Error.ValidateNotebookName.NotebookNameDotMessage': 'Notebook name cannot begin or end with a dot.',
'Error.ValidateNotebookName.LengthLimitMessage': 'Notebook name must be less than {0} characters.',
'Error.ValidateNotebookName.ContainsInvalidCharacterMessage': 'Notebook name contains invalid character: {0}',
'Error.ValidateSectionName.SectionNameDotMessage': 'Section name cannot begin or end with a dot.',
'Error.ValidateSectionName.LengthLimitMessage': 'Section name must be less than {0} characters.',
'Error.ValidateSectionName.ContainsInvalidCharacterMessage': 'Section name contains invalid character: {0}',
'Accessibility.NotebookIcon': 'Notebook Icon',
'Accessibility.SectionGroupIcon': 'Section Group Icon',
'Accessibility.SectionIcon': 'Section Icon',
'Accessibility.PickerTableName': 'Save Locations',
'Accessibility.PageIcon': 'Page Icon',
'Label.CreateNotebook': 'Create New Notebook',
'Label.CreateSection': 'Create New Section',
'Label.RecentSections': 'Recent Sections',
'Input.CreateNotebookPlaceholder': 'Untitled Notebook',
'Input.CreateSectionPlaceholder': 'Untitled Section'
};
static setOverrides(overrides: {} | undefined) {
this.overrides = overrides;
}
static get(key: string): string {
const overrides = this.overrides || {};
return overrides[key] || this.defaults[key] || '';
}
static getError(responseCode: number) {
const responseStr = responseCode + '';
if (responseStr.indexOf('4') === 0) {
return this.get('Error.4XX');
}
if (responseStr.indexOf('5') === 0) {
return this.get('Error.5XX');
}
return this.get('Error.Fallback');
}
}