diff --git a/lib/review/book/index.rb b/lib/review/book/index.rb index 72a406c77..b4a392bf7 100644 --- a/lib/review/book/index.rb +++ b/lib/review/book/index.rb @@ -108,7 +108,11 @@ def title(id) end def display_string(id) - "#{number(id)}#{I18n.t('chapter_quote', title(id))}" + if number(id) + I18n.t('chapter_quote', [number(id), title(id)]) + else + I18n.t('chapter_quote_without_number', title(id)) + end end end diff --git a/lib/review/builder.rb b/lib/review/builder.rb index abf0ca873..eb0f88812 100644 --- a/lib/review/builder.rb +++ b/lib/review/builder.rb @@ -352,7 +352,7 @@ def inline_column(id) end def inline_column_chap(chapter, id) - chapter.column(id).caption + I18n.t('column', chapter.column(id).caption) end def inline_pageref(id) diff --git a/lib/review/htmlbuilder.rb b/lib/review/htmlbuilder.rb index 1b69ab038..1a29f92cc 100644 --- a/lib/review/htmlbuilder.rb +++ b/lib/review/htmlbuilder.rb @@ -965,9 +965,9 @@ def inline_bib(id) def inline_hd_chap(chap, id) n = chap.headline_index.number(id) if chap.number and @book.config['secnolevel'] >= n.split('.').size - str = I18n.t('chapter_quote', "#{n} #{compile_inline(chap.headline(id).caption)}") + str = I18n.t('hd_quote', [n, compile_inline(chap.headline(id).caption)]) else - str = I18n.t('chapter_quote', compile_inline(chap.headline(id).caption)) + str = I18n.t('hd_quote_without_number', compile_inline(chap.headline(id).caption)) end if @book.config['chapterlink'] anchor = 'h' + n.gsub('.', '-') diff --git a/lib/review/i18n.rb b/lib/review/i18n.rb index aa8ee843d..4b255c868 100644 --- a/lib/review/i18n.rb +++ b/lib/review/i18n.rb @@ -90,6 +90,12 @@ def update_localefile(path) @store[key].merge!(values) end end + + # check obsolete locale parameter + s = t('chapter_quote', ['__!@!NUMBER!@!__', '__!@!TITLE!@!__']) + if s !~ /__!@!NUMBER!@!__/ || s !~ /__!@!TITLE!@!__/ + ReVIEW.logger.warn %Q('chapter_quote' should take 2 '%s' (number and title).) + end end def update(user_i18n, locale = nil) diff --git a/lib/review/i18n.yml b/lib/review/i18n.yml index d9a83a06b..f7726ed29 100644 --- a/lib/review/i18n.yml +++ b/lib/review/i18n.yml @@ -10,7 +10,10 @@ ja: chapter: 第%d章 chapter_short: "%d" chapter_postfix: " " - chapter_quote: "「%s」" + chapter_quote: "%s「%s」" + chapter_quote_without_number: "「%s」" + hd_quote: "「%s %s」" + hd_quote_without_number: "「%s」" appendix: 付録%pA numberless_image: "図:" memo_head: ■メモ @@ -72,7 +75,10 @@ en: chapter: Chapter %d chapter_short: "%d" chapter_postfix: ". " - chapter_quote: '"%s"' + chapter_quote: '%s "%s"' + chapter_quote_without_number: '"%s"' + hd_quote: '"%s %s"' + hd_quote_without_number: '"%s"' appendix: Appendix %s numberless_image: "Figure:" memo_head: Note @@ -126,12 +132,18 @@ zh-TW: image: 圖 table: 表 list: List + column: "Column %s" + columnname: "Column" + column_head: "Column" part: 第%pR部份 part_short: "%pR" chapter: 第%d章 chapter_short: "%d" chapter_postfix: " " - chapter_quote: "「%s」" + chapter_quote: "%s「%s」" + chapter_quote_without_number: "「%s」" + hd_quote: "「%s %s」" + hd_quote_without_number: "「%s」" appendix: 附錄%s numberless_image: "圖:" format_number: "%s.%d" diff --git a/lib/review/idgxmlbuilder.rb b/lib/review/idgxmlbuilder.rb index 545bb8a00..058ce4ace 100644 --- a/lib/review/idgxmlbuilder.rb +++ b/lib/review/idgxmlbuilder.rb @@ -1143,10 +1143,10 @@ def inline_hd_chap(chap, id) if chap.number n = chap.headline_index.number(id) if @book.config['secnolevel'] >= n.split('.').size - return I18n.t('chapter_quote', "#{n} #{compile_inline(chap.headline(id).caption)}") + return I18n.t('hd_quote', [n, compile_inline(chap.headline(id).caption)]) end end - I18n.t('chapter_quote', compile_inline(chap.headline(id).caption)) + I18n.t('hd_quote_without_number', compile_inline(chap.headline(id).caption)) rescue KeyError error "unknown headline: #{id}" end diff --git a/lib/review/latexbuilder.rb b/lib/review/latexbuilder.rb index 41acc5c5e..93c01c83c 100644 --- a/lib/review/latexbuilder.rb +++ b/lib/review/latexbuilder.rb @@ -992,9 +992,9 @@ def inline_bib(id) def inline_hd_chap(chap, id) n = chap.headline_index.number(id) if chap.number and @book.config['secnolevel'] >= n.split('.').size - str = I18n.t('chapter_quote', "#{chap.headline_index.number(id)} #{compile_inline(chap.headline(id).caption)}") + str = I18n.t('hd_quote', [chap.headline_index.number(id), compile_inline(chap.headline(id).caption)]) else - str = I18n.t('chapter_quote', compile_inline(chap.headline(id).caption)) + str = I18n.t('hd_quote_without_number', compile_inline(chap.headline(id).caption)) end if @book.config['chapterlink'] anchor = n.gsub(/\./, '-') @@ -1006,7 +1006,7 @@ def inline_hd_chap(chap, id) def inline_column_chap(chapter, id) macro('reviewcolumnref', - I18n.t('chapter_quote', compile_inline(chapter.column(id).caption)), + I18n.t('column', compile_inline(chapter.column(id).caption)), column_label(id, chapter)) rescue KeyError error "unknown column: #{id}" diff --git a/lib/review/plaintextbuilder.rb b/lib/review/plaintextbuilder.rb index 54a4d983d..b3aab066c 100644 --- a/lib/review/plaintextbuilder.rb +++ b/lib/review/plaintextbuilder.rb @@ -391,10 +391,10 @@ def inline_hd_chap(chap, id) if chap.number n = chap.headline_index.number(id) if @book.config['secnolevel'] >= n.split('.').size - return I18n.t('chapter_quote', "#{n} #{compile_inline(chap.headline(id).caption)}") + return I18n.t('hd_quote', [n, compile_inline(chap.headline(id).caption)]) end end - I18n.t('chapter_quote', compile_inline(chap.headline(id).caption)) + I18n.t('hd_quote_without_number', compile_inline(chap.headline(id).caption)) rescue KeyError error "unknown headline: #{id}" end diff --git a/test/test_plaintextbuilder.rb b/test/test_plaintextbuilder.rb index ef24fd5c8..103303fe9 100644 --- a/test/test_plaintextbuilder.rb +++ b/test/test_plaintextbuilder.rb @@ -382,7 +382,7 @@ def test_column_ref inside column next level -this is test. +this is コラム「test」. EOS assert_equal expected, column_helper(review) diff --git a/test/test_rstbuilder.rb b/test/test_rstbuilder.rb index c0b4a147c..d93e89c82 100644 --- a/test/test_rstbuilder.rb +++ b/test/test_rstbuilder.rb @@ -347,7 +347,7 @@ def test_column_ref next level -------------------- -this is test. +this is コラム「test」. EOS diff --git a/test/test_topbuilder.rb b/test/test_topbuilder.rb index ce5f50e45..4255f5658 100644 --- a/test/test_topbuilder.rb +++ b/test/test_topbuilder.rb @@ -406,7 +406,7 @@ def test_column_ref ◆→終了:コラム←◆ ■H3■next level -this is test. +this is コラム「test」. EOS assert_equal expected, column_helper(review)