-
Notifications
You must be signed in to change notification settings - Fork 512
/
Copy pathAvailableInWorkers.ejs
127 lines (110 loc) · 8.05 KB
/
AvailableInWorkers.ejs
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<%
// Inserts a notecards about this feature being available in Web Workers.
//
// Parameters:
//
// $0 - workerType (optional):
// 'window_and_dedicated': only in DedicatedWorker (and in Window)
// 'dedicated': only in DedicatedWorker
// 'window_and_worker_except_service': all workers but ServiceWorker (and in Window)
// 'window_and_worker_except_shared': all workers but shared workers (and in Window)
// 'worker_except_service': all workers but ServiceWorker (and no window)
// 'window_and_service': only in ServiceWorker (and in Window)
// 'service': only in ServiceWorker
// 'worker': All workers (and no Window)
// null: (default) All workers (and in Window)
//
// {{AvailableInWorkers}}
// {{AvailableInWorkers("worker_except_service")}}
//
const locale = env.locale;
const note = mdn.localString({
"de": "Hinweis:",
"en-US": "Note:",
"es": "Nota:",
"fr": "Note:",
"ja": "メモ:",
"ko": "참고:",
"ru": "Примечание:",
"zh-CN": "备注:",
"zh-TW": "備註:",
});
const textDefault = mdn.localString({
"de": `Dieses Feature ist verfügbar in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>.`,
"en-US": `This feature is available in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>.`,
"zh-CN": `此特性在 <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Worker</a> 中可用。`,
"zh-TW": `此功能可在 <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Worker</a> 中使用。`,
"es": `Esta característica está disponible en <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>.`,
"fr": `Cette fonctionnalité est disponible via les <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>.`,
"ja": `この機能は<a href="/${locale}/docs/Web/API/Web_Workers_API">ウェブワーカー</a>内で利用可能です。`,
"ko": `이 기능은 <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Worker</a>에서 사용할 수 있습니다.`,
"ru": `Эта возможность доступна в <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>.`,
});
const textWorker = mdn.localString({
"de": `Dieses Feature ist nur verfügbar in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>.`,
"en-US": `This feature is only available in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>.`,
"ja": `この機能は<a href="/${locale}/docs/Web/API/Web_Workers_API">ウェブワーカー</a>内でのみ利用可能です。`,
"zh-CN": `此特性仅在 <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Worker</a> 中可用。`,
});
const textNotService = mdn.localString({
"de": `Dieses Feature ist verfügbar in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>, außer in <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Workers</a>.`,
"en-US": `This feature is available in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>, except for <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Workers</a>.`,
"ja": `この機能は<a href="/${locale}/docs/Web/API/Web_Workers_API">ウェブワーカー</a>内で利用可能ですが、<a href="/${locale}/docs/Web/API/Service_Worker_API">サービスワーカー</a>では使用できません。`,
"zh-CN": `此特性在 <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Worker</a>(不包括 <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Worker</a>)中可用。`,
"zh-TW": `此功能可在 <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Worker</a>(不包括 <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Worker</a>)中使用。`,
});
const textNotShared = mdn.localString({
"de": `Dieses Feature ist verfügbar in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>, außer in <a href="/${locale}/docs/Web/API/SharedWorkerGlobalScope">Shared Web Workers</a>.`,
"en-US": `This feature is available in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>, except for <a href="/${locale}/docs/Web/API/SharedWorkerGlobalScope">Shared Web Workers</a>.`,
"zh-CN": `此特性在 <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Worker</a>(不包括<a href="/${locale}/docs/Web/API/SharedWorkerGlobalScope">共享 Web Worker</a>)中可用。`,
});
const textNotServiceNotWindow = mdn.localString({
"de": `Dieses Feature ist nur verfügbar in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>, außer in <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Workers</a>.`,
"en-US": `This feature is only available in <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Workers</a>, except for <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Workers</a>.`,
"ja": `この機能は<a href="/${locale}/docs/Web/API/Web_Workers_API">ウェブワーカー</a>内でのみ利用可能ですが、<a href="/${locale}/docs/Web/API/Service_Worker_API">サービスワーカー</a>では使用できません。`,
"zh-CN": `此特性仅在 <a href="/${locale}/docs/Web/API/Web_Workers_API">Web Worker</a>(不包括 <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Worker</a>)中可用。`,
});
const textDedicated = mdn.localString({
"de": `Dieses Feature ist verfügbar in <a href="/${locale}/docs/Web/API/DedicatedWorkerGlobalScope">Dedicated Web Workers</a>.`,
"en-US": `This feature is available in <a href="/${locale}/docs/Web/API/DedicatedWorkerGlobalScope">Dedicated Web Workers</a>.`,
"ja": `この機能は<a href="/${locale}/docs/Web/API/DedicatedWorkerGlobalScope">専用ウェブワーカー</a>内で利用可能です。`,
"zh-CN": `此特性在<a href="/${locale}/docs/Web/API/DedicatedWorkerGlobalScope">专用 Web Worker</a>中可用。`,
});
const textDedicatedOnly = mdn.localString({
"de": `Dieses Feature ist nur verfügbar in <a href="/${locale}/docs/Web/API/DedicatedWorkerGlobalScope">Dedicated Web Workers</a>.`,
"en-US": `This feature is only available in <a href="/${locale}/docs/Web/API/DedicatedWorkerGlobalScope">Dedicated Web Workers</a>.`,
"ja": `この機能は<a href="/${locale}/docs/Web/API/DedicatedWorkerGlobalScope">専用ウェブワーカー</a>内でのみ利用可能です。`,
"zh-CN": `此特性仅在<a href="/${locale}/docs/Web/API/DedicatedWorkerGlobalScope">专用 Web Worker</a> 中可用。`,
});
const textService = mdn.localString({
"de": `Dieses Feature ist verfügbar in <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Workers</a>.`,
"en-US": `This feature is available in <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Workers</a>.`,
"ja": `この機能は<a href="/${locale}/docs/Web/API/Service_Worker_API">サービスワーカー</a>内で利用可能です。`,
"zh-CN": `此特性在 <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Worker</a> 中可用。`,
});
const textServiceOnly = mdn.localString({
"de": `Dieses Feature ist nur verfügbar in <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Workers</a>.`,
"en-US": `This feature is only available in <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Workers</a>.`,
"ja": `この機能は<a href="/${locale}/docs/Web/API/Service_Worker_API">サービスワーカー</a>内でのみ利用可能です。`,
"zh-CN": `此特性仅在 <a href="/${locale}/docs/Web/API/Service_Worker_API">Service Worker</a> 中可用。`,
})
const workerType = $0 || 'default';
const associatedText = {
default: () => textDefault,
worker: () => textWorker,
window_and_worker_except_service: () => textNotService,
window_and_worker_except_shared: () => textNotShared,
worker_except_service: () => textNotServiceNotWindow,
window_and_dedicated: () => textDedicated,
dedicated: () => textDedicatedOnly,
window_and_service: () => textService,
service: () => textServiceOnly,
};
if (!associatedText[workerType]) {
throw new Error(`'${workerType}' is not a recognized argument to this macro`);
}
const text = associatedText[workerType]();
%>
<div class="notecard note">
<p><strong><%- note %></strong> <%- text %></p>
</div>