Skip to content

Commit 4e2ed19

Browse files
authored
Work around window.i being overwritten (microsoft#2929)
1 parent bd2d45c commit 4e2ed19

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/** contains the ts-ignore, and the global window manipulation */
22
export const localize = (key: string, fallback: string) =>
33
// @ts-ignore
4-
'i' in window ? window.i(key) : fallback
4+
'__tsLocalize' in window ? window.__tsLocalize(key) : fallback

packages/typescriptlang-org/src/pages/dev/bug-workbench.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const Play: React.FC<Props> = (props) => {
4040
window.reactDOM = ReactDOM
4141
// @ts-ignore - so that plugins etc can use local functions
4242
window.i = i
43+
// @ts-ignore - same as window.i but hopefully not overwritten by App Insights
44+
window.__tsLocalize = i
4345

4446
const getLoaderScript = document.createElement('script');
4547
getLoaderScript.src = withPrefix("/js/vs.loader.js");

packages/typescriptlang-org/src/templates/play.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ const Play: React.FC<Props> = (props) => {
6666
window.reactDOM = ReactDOM
6767
// @ts-ignore - so that plugins etc can use i18n
6868
window.i = i
69+
// @ts-ignore - same as window.i but hopefully not overwritten by App Insights
70+
window.__tsLocalize = i
6971

7072
const getLoaderScript = document.createElement('script');
7173
getLoaderScript.src = withPrefix("/js/vs.loader.js");

0 commit comments

Comments
 (0)