Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /ai/translator/ai_translator_translate.tentative.https.any.html - WPT Dashboard Interop Dashboard
- /ai/translator/ai_translator_translate.tentative.https.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /ai/translator/ai_translator_translate.tentative.https.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /ai/translator/ai_translator_translate.tentative.https.any.worker.html - WPT Dashboard Interop Dashboard
// META: title=Translate from English to Japanese
// META: global=window,worker
// META: timeout=long
//
// Setting `timeout=long` as this test may require downloading the translation
// library and the language models.
'use strict';
promise_test(async t => {
const translatorFactory = ai.translator;
assert_not_equals(translatorFactory, null);
const translator = await translatorFactory.create({
sourceLanguage: "en",
targetLanguage: "ja"
});
assert_equals(await translator.translate('hello'), 'こんにちは');
});