Support i18n

This commit is contained in:
Daniel Imms
2018-01-24 11:15:56 -08:00
parent c41b35ae9c
commit 3e734fab79
3 changed files with 13 additions and 3 deletions
+3 -2
View File
@@ -3,6 +3,7 @@
* @license MIT
*/
import * as Strings from './Strings';
import { ITerminal, IBuffer, IDisposable } from './Interfaces';
import { isMac } from './utils/Browser';
import { RenderDebouncer } from './utils/RenderDebouncer';
@@ -41,7 +42,7 @@ export class AccessibilityManager implements IDisposable {
this._moreRowsElement = document.createElement('div');
this._moreRowsElement.style.clip = 'clip(0 0 0 0)';
this._moreRowsElement.textContent = 'In order to properly navigation the terminal buffer you need to enter navigation mode';
this._moreRowsElement.textContent = Strings.navigationModeMoreRows;
this._accessibilityTreeRoot.appendChild(this._moreRowsElement);
this._rowContainer = document.createElement('div');
@@ -156,7 +157,7 @@ export class AccessibilityManager implements IDisposable {
this._liveRegionLineCount++;
if (this._liveRegionLineCount === MAX_ROWS_TO_READ + 1) {
// TODO: Enable localization
this._liveRegion.textContent += 'Too much output to announce, navigate to rows manually to read';
this._liveRegion.textContent += Strings.tooMuchOutput;
}
}
+8
View File
@@ -0,0 +1,8 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
export let promptLabel = 'Terminal input';
export let navigationModeMoreRows = 'In order to properly navigation the terminal buffer you need to enter navigation mode';
export let tooMuchOutput = 'Too much output to announce, navigate to rows manually to read';
+2 -1
View File
@@ -36,6 +36,7 @@ import { Linkifier } from './Linkifier';
import { SelectionManager } from './SelectionManager';
import { CharMeasure } from './utils/CharMeasure';
import * as Browser from './utils/Browser';
import * as Strings from './Strings';
import { MouseHelper } from './utils/MouseHelper';
import { CHARSETS } from './Charsets';
import { CustomKeyEventHandler, LinkMatcherHandler, LinkMatcherValidationCallback, CharData, LineData } from './Types';
@@ -623,7 +624,7 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
this.textarea = document.createElement('textarea');
this.textarea.classList.add('xterm-helper-textarea');
// TODO: New API to set title? This could say "Terminal bash input", etc.
this.textarea.setAttribute('aria-label', 'Terminal input');
this.textarea.setAttribute('aria-label', Strings.promptLabel);
this.textarea.setAttribute('aria-multiline', 'false');
this.textarea.setAttribute('autocorrect', 'off');
this.textarea.setAttribute('autocapitalize', 'off');