Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f41de57893 |
@@ -108,6 +108,7 @@ import {
|
|||||||
TRANSLATE_TARGET_LANGUAGES,
|
TRANSLATE_TARGET_LANGUAGES,
|
||||||
normalizeLang,
|
normalizeLang,
|
||||||
isSupportedTargetLang,
|
isSupportedTargetLang,
|
||||||
|
translationUnavailableText,
|
||||||
} from '../../../utils/translation/langUtils';
|
} from '../../../utils/translation/langUtils';
|
||||||
import { chromeTranslationEngine } from '../../../utils/translation/chromeEngine';
|
import { chromeTranslationEngine } from '../../../utils/translation/chromeEngine';
|
||||||
import { SequenceCardStyle } from '../styles.css';
|
import { SequenceCardStyle } from '../styles.css';
|
||||||
@@ -2760,7 +2761,7 @@ function Messages() {
|
|||||||
description={
|
description={
|
||||||
translationSupported
|
translationSupported
|
||||||
? 'Translate messages written in other languages into this one. Runs entirely on your device — message text never leaves your computer or touches a cloud service.'
|
? 'Translate messages written in other languages into this one. Runs entirely on your device — message text never leaves your computer or touches a cloud service.'
|
||||||
: 'On-device translation isn’t available in this browser. Use a Chromium desktop browser (Chrome/Edge 138+) or the Lotus desktop app.'
|
: translationUnavailableText(isTauriEnv())
|
||||||
}
|
}
|
||||||
after={
|
after={
|
||||||
<SettingsSelect
|
<SettingsSelect
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { test } from 'node:test';
|
import { test } from 'node:test';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import {
|
import {
|
||||||
|
translationUnavailableText,
|
||||||
normalizeLang,
|
normalizeLang,
|
||||||
sameLanguage,
|
sameLanguage,
|
||||||
languageName,
|
languageName,
|
||||||
@@ -53,3 +54,9 @@ test('curated list: unique codes, English present', () => {
|
|||||||
assert.equal(new Set(codes).size, codes.length);
|
assert.equal(new Set(codes).size, codes.length);
|
||||||
assert.ok(codes.includes('en'));
|
assert.ok(codes.includes('en'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('translationUnavailableText: no "use the desktop app" inside the desktop app (#349)', () => {
|
||||||
|
assert.doesNotMatch(translationUnavailableText(true), /desktop app\.$|Lotus desktop app/);
|
||||||
|
assert.match(translationUnavailableText(true), /this version of the desktop app/);
|
||||||
|
assert.match(translationUnavailableText(false), /this browser/);
|
||||||
|
});
|
||||||
|
|||||||
@@ -85,3 +85,13 @@ export function languageName(code: string, uiLocale = 'en'): string {
|
|||||||
export function isSupportedTargetLang(code: string): boolean {
|
export function isSupportedTargetLang(code: string): boolean {
|
||||||
return CURATED_NAME.has(normalizeLang(code));
|
return CURATED_NAME.has(normalizeLang(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [Gitea #349] Why translation is unavailable, by platform. The desktop app
|
||||||
|
* on Linux/macOS (WebKit) lacks the on-device APIs too, so it must not send
|
||||||
|
* people to "the Lotus desktop app" they're already using.
|
||||||
|
*/
|
||||||
|
export const translationUnavailableText = (desktopApp: boolean): string =>
|
||||||
|
desktopApp
|
||||||
|
? 'On-device translation isn’t available in this version of the desktop app. It works in Chrome or Edge 138+ on a computer.'
|
||||||
|
: 'On-device translation isn’t available in this browser. Use Chrome or Edge 138+ on a computer.';
|
||||||
|
|||||||
Reference in New Issue
Block a user