Skip to content

Commit

Permalink
feat(i18n): Add i18n support for as many languages as possible
Browse files Browse the repository at this point in the history
(Cherry picked from 556103e but content mixed with later commits from
rebased i18n-for-all branch.)

For fetching a key from the rebased source  branch:

    function copykey () {
        sed -i -e "/^$1 = /d" *.ftl
        for ftl in *.ftl; do
            rg "^$1 =" ../i18n-for-all/i18n/$ftl >> $ftl
        done
    }
  • Loading branch information
Omikhleia authored and alerque committed Aug 4, 2022
1 parent 14b4139 commit aa11a5b
Show file tree
Hide file tree
Showing 65 changed files with 526 additions and 36 deletions.
49 changes: 25 additions & 24 deletions classes/book.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,30 +104,16 @@ function class:registerCommands ()
if SU.boolean(options.toc, true) then
SILE.call("tocentry", { level = level, number = number }, SU.subContent(content))
end
local lang = SILE.settings:get("document.language")
if SU.boolean(options.numbering, true) then
if options.prenumber then
if SILE.Commands[options.prenumber .. ":" .. lang] then
options.prenumber = options.prenumber .. ":" .. lang
end
SILE.call(options.prenumber)
end
SILE.call("show-multilevel-counter", { id = "sectioning" })
if options.postnumber then
if SILE.Commands[options.postnumber .. ":" .. lang] then
options.postnumber = options.postnumber .. ":" .. lang
end
SILE.call(options.postnumber)
if options.msg then
SILE.call("fluent", { number = number }, { options.msg })
else
SILE.call("show-multilevel-counter", { id = "sectioning" })
end
end
end)

self:registerCommand("book:chapter:pre", function (_, _)
SILE.call("fluent", {}, { "book-chapter-title-pre" })
end)

self:registerCommand("book:chapter:post", function (_, _)
SILE.call("fluent", {}, { "book-chapter-post" })
SILE.call("par")
end)

Expand Down Expand Up @@ -157,10 +143,15 @@ function class:registerCommands ()
numbering = options.numbering,
toc = options.toc,
level = 1,
prenumber = "book:chapter:pre",
postnumber = "book:chapter:post"
msg = "book-chapter-title"
}, content)
end)
local lang = SILE.settings:get("document.language")
local postcmd = "book:chapter:post"
if SILE.Commands[postcmd .. ":" .. lang] then
postcmd = postcmd .. ":" .. lang
end
SILE.call(postcmd)
SILE.call("book:chapterfont", {}, content)
SILE.call("left-running-head", {}, function ()
SILE.settings:temporarily(function ()
Expand All @@ -180,9 +171,14 @@ function class:registerCommands ()
SILE.call("book:sectioning", {
numbering = options.numbering,
toc = options.toc,
level = 2,
postnumber = "book:section:post"
level = 2
}, content)
local lang = SILE.settings:get("document.language")
local postcmd = "book:section:post"
if SILE.Commands[postcmd .. ":" .. lang] then
postcmd = postcmd .. ":" .. lang
end
SILE.call(postcmd)
SILE.process(content)
end)
if not SILE.scratch.counters.folio.off then
Expand Down Expand Up @@ -215,11 +211,16 @@ function class:registerCommands ()
SILE.call("book:sectioning", {
numbering = options.numbering,
toc = options.toc,
level = 3,
postnumber = "book:subsection:post"
level = 3
}, content)
SILE.process(content)
end)
local lang = SILE.settings:get("document.language")
local postcmd = "book:subsection:post"
if SILE.Commands[postcmd .. ":" .. lang] then
postcmd = postcmd .. ":" .. lang
end
SILE.call(postcmd)
SILE.typesetter:leaveHmode()
SILE.call("novbreak")
SILE.call("medskip")
Expand Down
9 changes: 9 additions & 0 deletions i18n/af.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Hoofstuk { $number }
tableofcontents-title = Inhoudsopgawe
9 changes: 9 additions & 0 deletions i18n/am.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = ክፍል { $number }
tableofcontents-title = ይዘት
9 changes: 9 additions & 0 deletions i18n/ar.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = باب { $number }
tableofcontents-title = المحتويات
9 changes: 9 additions & 0 deletions i18n/as.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = অধ্যায় { $number }
tableofcontents-title = সমল
9 changes: 9 additions & 0 deletions i18n/bg.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Глава { $number }
tableofcontents-title = Съдържание
9 changes: 9 additions & 0 deletions i18n/bn.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = অধ্যায় { $number }
tableofcontents-title = সূচীপত্র
9 changes: 9 additions & 0 deletions i18n/bo.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = ལེའུ་ { $number }
tableofcontents-title = དཀར་ཆག།
9 changes: 9 additions & 0 deletions i18n/ca.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Capítol { $number }
tableofcontents-title = Índex
8 changes: 7 additions & 1 deletion i18n/cs.ftl
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
book-chapter-title-pre = Kapitola{" "}
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Kapitola { $number }
tableofcontents-title = Obsah
3 changes: 3 additions & 0 deletions i18n/cy.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
book-chapter-title = Pennod { $number }
tableofcontents-title = Cynnwys
9 changes: 9 additions & 0 deletions i18n/da.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Kapitel { $number }
tableofcontents-title = Indhold
9 changes: 9 additions & 0 deletions i18n/de.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Kapitel { $number }
tableofcontents-title = Inhaltsverzeichnis
9 changes: 9 additions & 0 deletions i18n/el-monoton.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Κεφάλαιο { $number }
tableofcontents-title = Περιεχόμενα
9 changes: 9 additions & 0 deletions i18n/el-polyton.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Κεφάλαιο { $number }
tableofcontents-title = Περιεχόμενα
9 changes: 9 additions & 0 deletions i18n/el.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Κεφάλαιο { $number }
tableofcontents-title = Περιεχόμενα
4 changes: 3 additions & 1 deletion i18n/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ bibliography-et-al = et al.
bibliography-translated-by = Translated by { $name }
book-chapter-title-pre = Chapter{" "}
book-chapter-title = { chapter } { $number }
book-chapter-title = Chapter { $number }
hello = Hello <em>{ $name }</em>!
Expand Down
8 changes: 7 additions & 1 deletion i18n/eo.ftl
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
bibliography-and = kaj
bibliography-edited-by = { $name }
bibliography-edited-by = Redaktita por { $name }
bibliography-et-al = et al.
bibliography-et-al = kaj aliaj
bibliography-translated-by = { $name }
bibliography-translated-by = Tradukita por { $name }
book-chapter-title-pre = Ĉapitro{" "}
book-chapter-title = Ĉapitro { $number }
hello = Saluton <em>{ $name }</em>!
Expand Down
9 changes: 9 additions & 0 deletions i18n/es.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Capítulo { $number }
tableofcontents-title = Índice
9 changes: 9 additions & 0 deletions i18n/et.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Peatükk { $number }
tableofcontents-title = Sisukord
9 changes: 9 additions & 0 deletions i18n/eu.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title ={ $number }. Kapitulua
tableofcontents-title = Gaien Aurkibidea
9 changes: 9 additions & 0 deletions i18n/fi.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Luku { $number }
tableofcontents-title = Sisällys
9 changes: 9 additions & 0 deletions i18n/fr.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = Édité par { $name }
bibliography-et-al = et al.
bibliography-translated-by = Traduit par { $name }
book-chapter-title = Chapitre { $number }
tableofcontents-title = Table des matières
9 changes: 9 additions & 0 deletions i18n/ga.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Caibidil { $number }
tableofcontents-title = Clár Ábhair
5 changes: 5 additions & 0 deletions i18n/gu.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
9 changes: 9 additions & 0 deletions i18n/hi.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = अध्याय { $number }
tableofcontents-title = अनुक्रम
9 changes: 9 additions & 0 deletions i18n/hr.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Poglavlje { $number }
tableofcontents-title = Sadržaj
9 changes: 9 additions & 0 deletions i18n/hu.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = { number }. fejezet
tableofcontents-title = Tartalomjegyzék
9 changes: 9 additions & 0 deletions i18n/hy.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Գլուխ { $number }
tableofcontents-title = Բովանդակություն
9 changes: 9 additions & 0 deletions i18n/id.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Bab { $number }
tableofcontents-title = Daftar Isi
9 changes: 9 additions & 0 deletions i18n/is.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bibliography-edited-by = { $name }
bibliography-et-al = et al.
bibliography-translated-by = { $name }
book-chapter-title = Kafli { $number }
tableofcontents-title = Efnisyfirlit
Loading

0 comments on commit aa11a5b

Please sign in to comment.