Skip to content

Commit

Permalink
Merge pull request #12796 from keymanapp/chore/merge-master-into-web-…
Browse files Browse the repository at this point in the history
…core-again

chore(core): merge master into epic/web-core 🎼
  • Loading branch information
ermshiperete authored Dec 9, 2024
2 parents f82a1d7 + 8252a95 commit 6c3faa2
Show file tree
Hide file tree
Showing 60 changed files with 1,052 additions and 549 deletions.
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Keyman Version History

## 18.0.153 alpha 2024-12-05

* feat(developer,common): verify normalization of strings (#12748)
* chore(core): Add link to Keyman Glossary (#12774)
* test(common/web/types): unit tests for file-types (#12716)

## 18.0.152 alpha 2024-12-04

* refactor(mac): pass kmx data blob to keyman core instead of file path (#12760)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.0.153
18.0.154
16 changes: 8 additions & 8 deletions android/KMAPro/kMAPro/src/main/res/values-it-rIT/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<!-- Context: Keyman Settings menu -->
<string name="adjust_keyboard_height" comment="Menu action to adjust keyboard height">Regola altezza tastiera</string>
<!-- Context: Keyman Settings menu -->
<string name="adjust_longpress_delay" comment="Menu action to adjust longpress delay duration">Adjust longpress delay</string>
<string name="adjust_longpress_delay" comment="Menu action to adjust longpress delay duration">Regola ritardo pressione prolungata</string>
<!-- Context: Keyman Settings menu -->
<string name="spacebar_caption" comment="Menu action to set the spacebar caption">Didascalia barra spaziatrice</string>
<!-- Context: Keyman Settings menu / Spacebar caption -->
Expand All @@ -89,11 +89,11 @@
<string name="spacebar_caption_hint_blank" comment="Spacebar caption hint - blank">Non mostrare la didascalia sulla barra spaziatrice</string>
<!-- Context: Keyman Settings menu / Haptic feedback -->
<string name="haptic_feedback" comment="haptic feedback on key press">Vibra durante la digitazione</string>
<!-- Context: Keyman Settings menu -->
<!-- Context: Keyman Settings menu. Removed in Keyman 18 -->
<string name="show_banner" comment="text suggestions banner">Mostra sempre il banner</string>
<!-- Context: Keyman Settings menu -->
<!-- Context: Keyman Settings menu. Removed in Keyman 18 -->
<string name="show_banner_on" comment="Description when toggle is on">Da attuare</string>
<!-- Context: Keyman Settings menu -->
<!-- Context: Keyman Settings menu. Removed in Keyman 18 -->
<string name="show_banner_off" comment="Description when toggle is off">Quando è spento, mostrato solo quando il testo predittivo è abilitato</string>
<!-- Context: Keyman Settings menu -->
<string name="show_send_crash_report" comment="permission for sending crash reports">Consenti l\'invio di segnalazioni di crash attraverso la rete</string>
Expand Down Expand Up @@ -126,13 +126,13 @@
<!-- Context: Adjust Keyboard Height menu -->
<string name="reset_to_defaults" comment="Button to reset to default heights">Ripristina impostazioni predefinite</string>
<!-- Context: Adjust Longpress Delay Time menu -->
<string name="longpress_delay_time" comment="Current longpress delay time (seconds)">Delay Time: %1$.1f seconds</string>
<string name="longpress_delay_time" comment="Current longpress delay time (seconds)">Tempo ritardo: %1$.1f secondi</string>
<!-- Context: Adjust Longpress Delay Time menu -->
<string name="ic_delay_time_up" comment="Make longpress delay longer">Delay time longer</string>
<string name="ic_delay_time_up" comment="Make longpress delay longer">Tempo ritardo maggiore</string>
<!-- Context: Adjust Longpress Delay Time menu -->
<string name="ic_delay_time_down" comment="Make longpress delay shorter">Delay time shorter</string>
<string name="ic_delay_time_down" comment="Make longpress delay shorter">Tempo ritardo minore</string>
<!-- Context: Adjust Longpress Delay Time menu -->
<string name="ic_longpress_delay_slider" comment="Adjust longpress delay time">Longpress delay time slider</string>
<string name="ic_longpress_delay_slider" comment="Adjust longpress delay time">Cursore tempo ritardo pressione prolungata</string>
<!-- Context: Keyman Web Browser -->
<string name="hint_text" comment="Prompt to type in the browser search bar">Cerca o digita URL</string>
<!-- Context: Keyman Web Browser -->
Expand Down
9 changes: 7 additions & 2 deletions android/KMEA/app/src/main/res/values-it-rIT/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,15 @@
<string name="keyboard_install_toast" comment="Notification when a keyboard is installed">%1$s tastiera installata</string>
<!-- Context: Language Settings Keyboard uninstall strings -->
<string name="keyboard_deleted_toast" comment="Notification when a keyboard is deleted">Tastiera eliminata</string>
<!-- Context: Language Settings menu strings -->
<!-- Context: Language Settings menu strings. Removed in Keyman 18 -->
<string name="enable_corrections" comment="Enable corrections from the suggestion banner">Abilita correzioni</string>
<!-- Context: Language Settings menu strings -->
<!-- Context: Language Settings menu strings. Removed in Keyman 18 -->
<string name="enable_predictions" comment="Enable predictions from the suggestion banner">Abilita previsioni</string>
<!-- Context: Language Settings menu strings - radio buttons -->
<string name="suggestions_radio_0" comment="Predictions and corrections disabled">Disabilita suggerimenti</string>
<string name="suggestions_radio_1" comment="Suggestions Enabled: Predictions with no corrections">Solo previsioni</string>
<string name="suggestions_radio_2" comment="Suggestions Enabled: Predictions with corrections">Previsioni con correzioni</string>
<string name="suggestions_radio_3" comment="Suggestions Enabled: Predictions with auto-corrections">Previsioni con correzioni automatiche</string>
<!-- Context: Language Settings menu strings -->
<string name="model_label">Dizionario</string>
<plurals name="model_count">
Expand Down
234 changes: 234 additions & 0 deletions common/web/types/tests/util/file-types.tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*
* Created by Dr Mark C. Sinclair on 2024-11-29
*
* Test code for file-types.ts
*/

import 'mocha';
import { assert } from 'chai';
import {
ALL,
ALL_SOURCE,
ALL_BINARY,
Binary,
fromFilename,
removeExtension,
sourceOrBinaryTypeFromFilename,
sourceTypeFromFilename,
binaryTypeFromFilename,
filenameIs,
replaceExtension,
} from '../../src/util/file-types.js';

describe('Test of File-Types', () => {
describe('Test of fromFilename()', () => {
it('can extract Source file extension', () => {
ALL_SOURCE.forEach((ext) => {
const filename = `file${ext}`;
const actual = fromFilename(filename);
assert.deepEqual(actual, ext);
});
});
it('can extract Binary file extension', () => {
ALL_BINARY.forEach((ext) => {
const filename = `file${ext}`;
const actual = fromFilename(filename);
assert.deepEqual(actual, ext);
});
});
it('can extract unmatched file extension', () => {
const ext = ".cpp";
assert.isFalse((Object.values(ALL_SOURCE) as string[]).includes(ext));
const filename = `file${ext}`;
const actual = fromFilename(filename);
assert.deepEqual(actual, ext);
});
it('returns empty string for no file extension', () => {
const filename = `file`;
const actual = fromFilename(filename);
assert.deepEqual(actual, "");
});
it('can extract upper case file extension', () => {
const ext = ALL_SOURCE[0];
const upperCaseExt = ext.toUpperCase();
const filename = `file${upperCaseExt}`;
const actual = fromFilename(filename);
assert.deepEqual(actual, ext);
});
});
describe('Test of removeExtension()', () => {
it('can remove Source file extension', () => {
ALL_SOURCE.forEach((ext) => {
const filename = `file${ext}`;
const actual = removeExtension(filename);
assert.deepEqual(actual, "file");
});
});
it('can remove Binary file extension', () => {
ALL_BINARY.forEach((ext) => {
const filename = `file${ext}`;
const actual = removeExtension(filename);
assert.deepEqual(actual, "file");
});
});
it('can handle no file extension', () => {
const filename = removeExtension("file");
assert.deepEqual(filename, "file");
});
});
describe('Test of sourceOrBinaryTypeFromFilename()', () => {
it('can extract Source file extension', () => {
ALL_SOURCE.forEach((ext) => {
const filename = `file${ext}`;
const actual = sourceOrBinaryTypeFromFilename(filename);
assert.deepEqual(actual, ext);
});
});
it('can extract Binary file extension', () => {
ALL_BINARY.forEach((ext) => {
const filename = `file${ext}`;
const actual = sourceOrBinaryTypeFromFilename(filename);
assert.deepEqual(actual, ext);
});
});
it('returns null for unmatched file extension', () => {
const ext = ".cpp";
assert.isFalse((Object.values(ALL) as string[]).includes(ext));
const filename = `file${ext}`;
const actual = sourceOrBinaryTypeFromFilename(filename);
assert.isNull(actual);
});
it('can extract upper case file extension', () => {
const ext = ALL[0];
const upperCaseExt = ext.toUpperCase();
const filename = `file${upperCaseExt}`;
const actual = sourceOrBinaryTypeFromFilename(filename);
assert.deepEqual(actual, ext);
});
});
describe('Test of sourceTypeFromFilename()', () => {
it('can extract Source file extension', () => {
ALL_SOURCE.forEach((ext) => {
const filename = `file${ext}`;
const actual = sourceTypeFromFilename(filename);
assert.deepEqual(actual, ext);
});
});
it('returns null for a Binary file extension', () => {
ALL_BINARY.forEach((ext) => {
const filename = `file${ext}`;
const actual = sourceTypeFromFilename(filename);
assert.isNull(actual);
});
});
it('returns null for unmatched file extension', () => {
const ext = ".cpp";
assert.isFalse((Object.values(ALL_SOURCE) as string[]).includes(ext));
const filename = `file${ext}`;
const actual = sourceTypeFromFilename(filename);
assert.isNull(actual);
});
it('can extract upper case file extension', () => {
const ext = ALL_SOURCE[0];
const upperCaseExt = ext.toUpperCase();
const filename = `file${upperCaseExt}`;
const actual = sourceTypeFromFilename(filename);
assert.deepEqual(actual, ext);
});
});
describe('Test of binaryTypeFromFilename()', () => {
it('returns null for a Source file extension', () => {
ALL_SOURCE.forEach((ext) => {
const filename = `file${ext}`;
const actual = binaryTypeFromFilename(filename);
assert.isNull(actual);
});
});
it('can extract Binary file extension', () => {
ALL_BINARY.forEach((ext) => {
const filename = `file${ext}`;
const actual = binaryTypeFromFilename(filename);
assert.deepEqual(actual, ext);
});
});
it('returns null for unmatched file extension', () => {
const ext = ".cpp";
assert.isFalse((Object.values(ALL_BINARY) as string[]).includes(ext));
const filename = `file${ext}`;
const actual = binaryTypeFromFilename(filename);
assert.isNull(actual);
});
it('can extract upper case file extension', () => {
const ext = ALL_BINARY[0];
const upperCaseExt = ext.toUpperCase();
const filename = `file${upperCaseExt}`;
const actual = binaryTypeFromFilename(filename);
assert.deepEqual(actual, ext);
});
});
describe('Test of filenameIs()', () => {
it('can identify Source file extension', () => {
ALL_SOURCE.forEach((ext) => {
const filename = `file${ext}`;
const actual = filenameIs(filename, ext);
assert.isTrue(actual);
});
});
it('can identify Binary file extension', () => {
ALL_BINARY.forEach((ext) => {
const filename = `file${ext}`;
if (ext == Binary.Model) { // Special case for .model.js
const actual = filenameIs(filename, Binary.WebKeyboard);
assert.isFalse(actual);
}
const actual = filenameIs(filename, ext);
assert.isTrue(actual);
});
});
it('can identify upper case file extension', () => {
const ext = ALL[0];
const upperCaseExt = ext.toUpperCase();
const filename = `file${upperCaseExt}`;
const actual = filenameIs(filename, ext);
assert.isTrue(actual);
});
});
describe('Test of replaceExtension()', () => {
it('can replace an extension', () => {
const oldExt = ".cpp";
const newExt = ".js";
const oldFilename = `file${oldExt}`;
const newFilename = `file${newExt}`;
const actual = replaceExtension(oldFilename, oldExt, newExt);
assert.deepEqual(actual, newFilename);
});
it('should return null for incorrect old extension (too short)', () => {
const oldExt = ".ts";
const newExt = ".js";
const oldFilename = `file.c`;
const actual = replaceExtension(oldFilename, oldExt, newExt);
assert.isNull(actual);
});
it('should return null for incorrect old extension (too long)', () => {
const oldExt = ".ts";
const newExt = ".js";
const oldFilename = `file.cpp`;
const actual = replaceExtension(oldFilename, oldExt, newExt);
assert.isNull(actual);
});
// it('should return null for null old extension', () => {
// const newExt = ".js";
// const oldFilename = `file.ts`;
// const actual = replaceExtension(oldFilename, null, newExt);
// assert.isNull(actual);
// });
// it('should return null for null new extension', () => {
// const oldExt = ".ts";
// const oldFilename = `file.ts`;
// const actual = replaceExtension(oldFilename, oldExt, null);
// assert.isNull(actual);
// });
});
});
2 changes: 1 addition & 1 deletion core/docs/api/background.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ typedef enum { KM_CORE_FALSE = 0, KM_CORE_TRUE = 1 } km_core_bool;
[km_core_keyboard_attrs]: keyboards#km_core_keyboard_attrs "km_core_keyboard_attrs struct"
[km_core_keyboard_key]: keyboards#km_core_keyboard_key "km_core_keyboard_key struct"
[km_core_keyboard_imx]: keyboards#km_core_keyboard_imx "km_core_keyboard_imx struct"
[km_core_keyboard_load]: keyboards#km_core_keyboard_load "km_core_keyboard_load function"
[km_core_keyboard_load_from_blob]: keyboards#km_core_keyboard_load_from_blob "km_core_keyboard_load_from_blob function"
[km_core_keyboard_dispose]: keyboards#km_core_keyboard_dispose "km_core_keyboard_dispose function"
[km_core_keyboard_get_attrs]: keyboards#km_core_keyboard_get_attrs "km_core_keyboard_get_attrs function"
[km_core_keyboard_get_key_list]: keyboards#km_core_keyboard_get_key_list "km_core_keyboard_get_key_list function"
Expand Down
2 changes: 1 addition & 1 deletion core/docs/api/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ title: Changes - Keyman Core API
[km_core_keyboard_attrs]: keyboards#km_core_keyboard_attrs "km_core_keyboard_attrs struct"
[km_core_keyboard_key]: keyboards#km_core_keyboard_key "km_core_keyboard_key struct"
[km_core_keyboard_imx]: keyboards#km_core_keyboard_imx "km_core_keyboard_imx struct"
[km_core_keyboard_load]: keyboards#km_core_keyboard_load "km_core_keyboard_load function"
[km_core_keyboard_load_from_blob]: keyboards#km_core_keyboard_load_from_blob "km_core_keyboard_load_from_blob function"
[km_core_keyboard_dispose]: keyboards#km_core_keyboard_dispose "km_core_keyboard_dispose function"
[km_core_keyboard_get_attrs]: keyboards#km_core_keyboard_get_attrs "km_core_keyboard_get_attrs function"
[km_core_keyboard_get_key_list]: keyboards#km_core_keyboard_get_key_list "km_core_keyboard_get_key_list function"
Expand Down
2 changes: 1 addition & 1 deletion core/docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Caps Lock.
[km_core_keyboard_attrs]: keyboards#km_core_keyboard_attrs "km_core_keyboard_attrs struct"
[km_core_keyboard_key]: keyboards#km_core_keyboard_key "km_core_keyboard_key struct"
[km_core_keyboard_imx]: keyboards#km_core_keyboard_imx "km_core_keyboard_imx struct"
[km_core_keyboard_load]: keyboards#km_core_keyboard_load "km_core_keyboard_load function"
[km_core_keyboard_load_from_blob]: keyboards#km_core_keyboard_load_from_blob "km_core_keyboard_load_from_blob function"
[km_core_keyboard_dispose]: keyboards#km_core_keyboard_dispose "km_core_keyboard_dispose function"
[km_core_keyboard_get_attrs]: keyboards#km_core_keyboard_get_attrs "km_core_keyboard_get_attrs function"
[km_core_keyboard_get_key_list]: keyboards#km_core_keyboard_get_key_list "km_core_keyboard_get_key_list function"
Expand Down
Loading

0 comments on commit 6c3faa2

Please sign in to comment.