diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-25 11:20:44 -0500 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-25 16:20:44 +0000 | 
| commit | 2e9ea19207a7410f929bb908759d48cb2340f29c (patch) | |
| tree | a6bde1297d693bb8d50e4c93a963aa3179e5a2ce /ext/js/display/sandbox/structured-content-generator.js | |
| parent | 73169f06dff767020718a5715eba97d3575ba7e1 (diff) | |
"isJapanese" check move (#730)
* Move isStringPartiallyJapanese out of ClipboardMonitor
* Create isStringPartiallyJapanese function
* Add textMayBeTranslatable
* Rename API function
* Rename internal function
* Add helper
* Update translatable check
* Pass language to TextScanner
* Pass language explicitly
* Use textMayBeTranslatable
* No redundant translatable check
* Update eslint
* Remove double newline
* Collapse
* Rename
Diffstat (limited to 'ext/js/display/sandbox/structured-content-generator.js')
| -rw-r--r-- | ext/js/display/sandbox/structured-content-generator.js | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/ext/js/display/sandbox/structured-content-generator.js b/ext/js/display/sandbox/structured-content-generator.js index 1dfde39b..90a47158 100644 --- a/ext/js/display/sandbox/structured-content-generator.js +++ b/ext/js/display/sandbox/structured-content-generator.js @@ -16,7 +16,7 @@   * along with this program.  If not, see <https://www.gnu.org/licenses/>.   */ -import {isStringPartiallyJapanese} from '../../language/ja/japanese.js'; +import {getLanguageFromText} from '../../language/text-utilities.js';  export class StructuredContentGenerator {      /** @@ -163,8 +163,11 @@ export class StructuredContentGenerator {          if (typeof content === 'string') {              if (content.length > 0) {                  container.appendChild(this._createTextNode(content)); -                if (language === null && isStringPartiallyJapanese(content)) { -                    container.lang = 'ja'; +                if (language === null) { +                    const language2 = getLanguageFromText(content); +                    if (language2 !== null) { +                        container.lang = language2; +                    }                  }              }              return; |