diff --git a/Rules/Languages/ja/navigate.yaml b/Rules/Languages/ja/navigate.yaml
index 11c17d776..ad14b4d56 100644
--- a/Rules/Languages/ja/navigate.yaml
+++ b/Rules/Languages/ja/navigate.yaml
@@ -55,7 +55,7 @@
- if: "string-length(.) = 1"
then: [T: "ズームインを最大にしました"] # phrase('zoomed in all of the way')
- else_if: "$NavNodeOffset = 0"
- then: [t: "最初の文字にズームイン"] # phrase('zoomed in to first character')
+ then: [T: "最初の文字までズームしました"] # phrase('zoomed in to first character')
else: [T: "文字までズームしました"] # phrase('zoomed in to character')
- pause: "medium"
else:
@@ -577,7 +577,7 @@
- if: "$NavCommand = 'MoveStart'"
then: [T: "数式の先頭に移動"] # phrase('move to start of math')
- else_if: "$NavCommand = 'MoveLineStart'"
- then: [t: "行の先頭に移動"] # phrase('move to start of line')
+ then: [T: "行の先頭に移動"] # phrase('move to start of line')
- else_if: "$NavCommand = 'MoveEnd'"
then: [T: "数式の末尾に移動"] # phrase('move to end of math')
else: [T: "行の末尾に移動"] # "$NavCommand = 'MoveLineEnd'" # phrase('move to end of line')
@@ -620,7 +620,7 @@
then:
- test:
if: "$NavCommand = 'MoveLineStart'"
- then: [t: "行の先頭に移動"] # phrase('move to start of line')
+ then: [T: "行の先頭に移動"] # phrase('move to start of line')
else: [T: "行の末尾に移動"] # "$NavCommand = 'MoveLineEnd'" # phrase('move to end of line')
- pause: "medium"
- test:
@@ -671,7 +671,7 @@
- test:
if: "$NavVerbosity = 'Verbose'"
then:
- - t: "左に移動" # phrase('move left')
+ - T: "左に移動" # phrase('move left')
- pause: short
- test:
if: "$NavVerbosity != 'Terse'"
@@ -701,7 +701,7 @@
- test:
if: "$NavVerbosity = 'Verbose'"
then:
- - t: "右に移動" # phrase('move right')
+ - T: "右に移動" # phrase('move right')
- pause: short
- test:
if: "$NavVerbosity != 'Terse'"
@@ -718,7 +718,7 @@
else:
- set_variables: [NavNode: "following-sibling::*[1]/*[1]/@id"]
else:
- - t: "次の列はありません" # phrase('no next column' in the table)
+ - T: "次の列はありません" # phrase('no next column' in the table)
- set_variables: [SpeakExpression: "'false'"]
- name: move-cell-up
@@ -739,7 +739,7 @@
- test:
if: "$NavVerbosity != 'Terse'"
then:
- - t: "行" # phrase(the previous 'row' in the table)
+ - T: "行" # phrase(the previous 'row' in the table)
- x: "count(../preceding-sibling::*)"
- pause: short
- T: "列" # phrase(the previous 'column' in the table)
@@ -775,7 +775,7 @@
- test:
if: "$NavVerbosity != 'Terse'"
then:
- - t: "行" # phrase(the next 'row' in the table)
+ - T: "行" # phrase(the next 'row' in the table)
- x: "count(../preceding-sibling::*)+2"
- pause: short
- T: "列" # phrase(the next 'column' in the table)
@@ -800,7 +800,7 @@
- test:
if: "$NavVerbosity = 'Verbose'"
then:
- - t: "前の行に移動" # phrase('move to previous row' in the table)
+ - T: "前の行に移動" # phrase('move to previous row' in the table)
- pause: medium
- test:
if: "preceding-sibling::*"
@@ -824,7 +824,7 @@
- test:
if: "$NavVerbosity = 'Verbose'"
then:
- - t: "次の行に移動" # phrase('move to next row' in the table)
+ - T: "次の行に移動" # phrase('move to next row' in the table)
- pause: medium
- test:
if: "following-sibling::*"
@@ -849,7 +849,7 @@
- test:
if: "$NavVerbosity = 'Verbose'"
then:
- - t: "前の列に移動" # phrase('move to previous column' in the table)
+ - T: "前の列に移動" # phrase('move to previous column' in the table)
- pause: medium
- T: "前の列はありません" # phrase('no previous column' in the table)
- set_variables: [SpeakExpression: "'false'"]
@@ -862,9 +862,9 @@
- test:
if: "$NavVerbosity = 'Verbose'"
then:
- - t: "次の列に移動" # phrase('move to next column' in the table)
+ - T: "次の列に移動" # phrase('move to next column' in the table)
- pause: medium
- - t: "次の列はありません" # phrase('no next row' in the table)
+ - T: "次の列はありません" # phrase('no next row' in the table)
- set_variables: [SpeakExpression: "'false'"]
- name: default-read-cell
@@ -880,12 +880,12 @@
- test:
if: "$NavVerbosity = 'Verbose'"
then:
- - t: "現在のエントリを読む" # phrase('read current entry' in the table)
+ - T: "現在のセルを読む" # phrase('read current entry' in the table)
- pause: medium
- test:
if: "$NavVerbosity != 'Terse'"
then:
- - t: "行" # phrase(the previous 'row' in the table)
+ - T: "行" # phrase(the previous 'row' in the table)
- x: "count($MTD[1]/../preceding-sibling::*)+1"
- pause: short
- T: "列" # phrase(the previous 'column' in the table)
@@ -1210,7 +1210,7 @@
- test:
if: "$MatchCounter = 0 and $NavVerbosity = 'Verbose'"
then:
- - t: "右に移動できません" # phrase('cannot move right')
+ - T: "右に移動できません" # phrase('cannot move right')
- pause: medium
- with:
variables:
@@ -1428,7 +1428,7 @@
- test:
if: "$MatchCounter = 0 and $NavVerbosity = 'Verbose' and $NavCommand = 'MovePrevious'"
then:
- - t: "左に移動できません" # phrase('cannot move left' in expression)
+ - T: "左に移動できません" # phrase('cannot move left' in expression)
- pause: medium
- with:
variables:
@@ -1458,7 +1458,7 @@
- test:
if: "$MatchCounter = 0 and $NavVerbosity = 'Verbose'"
then:
- - t: "左に移動できません" # phrase('cannot move left')
+ - T: "左に移動できません" # phrase('cannot move left')
- pause: short
- with:
variables: [Move2D: "'start of'", Child2D: "."]
@@ -1644,12 +1644,12 @@
- set_variables: [NavMode: "'Character'", ReadZoomLevel: "1"]
- else_if: "$NavMode = 'Character'"
then:
- - t: "シンプル" # phrase(a 'simple' way to do something)
+ - T: "簡易" # phrase(a 'simple' way to do something)
- set_variables: [NavMode: "'Simple'", ReadZoomLevel: "1"]
- else:
- T: "拡張" # phrase(an 'enhanced' way to do something)
- set_variables: [NavMode: "'Enhanced'", ReadZoomLevel: "-1"]
- - t: "モード" # phrase(a simple 'mode' of use)
+ - T: "モード" # phrase(a simple 'mode' of use)
- pause: long
- test:
- if: "$NavMode != 'Enhanced'" # potentially need to zoom to the sibling
@@ -1665,7 +1665,7 @@
- test:
- if: "$NavMode = 'Enhanced'"
then:
- - t: "シンプル" # phrase(a 'simple' way to do something)
+ - T: "簡易" # phrase(a 'simple' way to do something)
- set_variables: [NavMode: "'Simple'", ReadZoomLevel: "1"]
- else_if: "$NavMode = 'Character'"
then:
@@ -1674,7 +1674,7 @@
- else:
- T: "文字" # phrase(a mathematical 'character')
- set_variables: [NavMode: "'Character'", ReadZoomLevel: "1"]
- - t: "モード" # phrase(a simple 'mode' of use)
+ - T: "モード" # phrase(a simple 'mode' of use)
- pause: long
- test:
- if: "$NavMode != 'Enhanced'" # potentially need to zoom to the sibling
@@ -1694,7 +1694,7 @@
- pause: long
- set_variables: [Overview: "'false'"]
else:
- - t: "移動後の式の概要" # phrase('overview of expression after move')
+ - T: "移動後に式の概要を読み上げる" # phrase('overview of expression after move')
- pause: long
- set_variables: [Overview: "'true'"]
diff --git a/tests/Languages/ja/navigate.rs b/tests/Languages/ja/navigate.rs
index 32ca5edc3..b90aaea27 100644
--- a/tests/Languages/ja/navigate.rs
+++ b/tests/Languages/ja/navigate.rs
@@ -11,11 +11,15 @@ use anyhow::Result;
use std::panic::{catch_unwind, AssertUnwindSafe};
fn init_nav(mathml: &str) -> Result<()> {
+ init_nav_in_mode(mathml, "Enhanced")
+}
+
+fn init_nav_in_mode(mathml: &str, nav_mode: &str) -> Result<()> {
set_rules_dir(abs_rules_dir_path())?;
set_preference("Language", "ja")?;
set_preference("SpeechStyle", "SimpleSpeak")?;
set_preference("Verbosity", "Medium")?;
- set_preference("NavMode", "Enhanced")?;
+ set_preference("NavMode", nav_mode)?;
set_preference("NavVerbosity", "Verbose")?;
set_preference("AutoZoomOut", "False")?;
set_preference("Overview", "False")?;
@@ -24,9 +28,13 @@ fn init_nav(mathml: &str) -> Result<()> {
}
fn assert_command_prefix(mathml: &str, commands: &[&str], expected: &str) -> Result<()> {
+ assert_command_prefix_in_mode(mathml, "Enhanced", commands, expected)
+}
+
+fn assert_command_prefix_in_mode(mathml: &str, nav_mode: &str, commands: &[&str], expected: &str) -> Result<()> {
init_panic_handler();
let result = catch_unwind(AssertUnwindSafe(|| {
- init_nav(mathml)?;
+ init_nav_in_mode(mathml, nav_mode)?;
let mut speech = String::new();
for command in commands {
speech = do_navigate_command(command)?;
@@ -54,6 +62,12 @@ fn assert_speech(mathml: &str, commands: &[&str], expected: &str) -> Result<()>
const EXPR: &str = r#""#;
+/// A leaf with more than one character, so that zooming in has a first
+/// character to land on.
+const MULTI_CHAR: &str = r#""#;
+
+const TABLE: &str = r#""#;
+
/// The prefix used to be the English word "zoom", spoken as-is by a Japanese
/// synthesiser. ズーム + イン also reads as the ordinary loanword.
#[test]
@@ -120,3 +134,37 @@ fn placemarker_names_the_placeholder_first() -> Result<()> {
fn reading_a_placemarker_names_it_first() -> Result<()> {
assert_speech(EXPR, &["SetPlacemarker3", "Read3"], "プレースホルダー 3 を 読み上げ; x の 2 乗 プラス 1")
}
+
+/// Character mode steps inside a leaf: ZoomInAll reaches the leaf, and one more
+/// ZoomIn lands on its first character (the same sequence as move_inside_leaves
+/// in src/navigate.rs). The other two zoom reports are sentences
+/// (ズームインを最大にしました, 文字までズームしました); this one was a bare noun
+/// phrase, so it did not read as a report of where the zoom ended up.
+#[test]
+fn zooming_to_the_first_character_reports_it() -> Result<()> {
+ assert_command_prefix_in_mode(
+ MULTI_CHAR, "Character", &["ZoomInAll", "ZoomIn"], "最初の文字までズームしました")
+}
+
+/// The three navigation modes are spoken as + モード. 文字 and 拡張 are
+/// ordinary words; シンプル was a transliteration sitting between them.
+#[test]
+fn the_simple_mode_is_named_like_the_others() -> Result<()> {
+ assert_command_prefix(EXPR, &["ToggleZoomLockUp", "ToggleZoomLockUp"], "簡易 モード")
+}
+
+/// エントリ appeared exactly once in the whole Japanese rule set. This rule
+/// speaks 行 and 列 straight after it, and the sibling rule says 表, so セル is
+/// the word these rules already use for the thing being read.
+#[test]
+fn reading_the_current_cell_calls_it_a_cell() -> Result<()> {
+ assert_command_prefix(TABLE, &["ZoomInAll", "ReadCellCurrent"], "現在のセルを読む")
+}
+
+/// The two states of one toggle. The other is the sentence 移動後に式を読み上げる;
+/// this one was the noun phrase 移動後の式の概要, which does not say what will
+/// happen to it.
+#[test]
+fn the_overview_toggle_says_what_it_will_do() -> Result<()> {
+ assert_command_prefix(EXPR, &["ToggleSpeakMode"], "移動後に式の概要を読み上げる")
+}