other languages
This commit is contained in:
parent
59574d623b
commit
1538172cae
3 changed files with 19 additions and 8 deletions
|
@ -30,8 +30,17 @@ def build(directory, sign):
|
||||||
tmp = os.path.join(directory, TMP)
|
tmp = os.path.join(directory, TMP)
|
||||||
# for each language
|
# for each language
|
||||||
for language in LANGUAGES:
|
for language in LANGUAGES:
|
||||||
|
# other languages
|
||||||
|
other_languages = ','.join(
|
||||||
|
[lang for lang in LANGUAGES if lang is not language])
|
||||||
|
# display languages
|
||||||
|
print()
|
||||||
|
print(language, other_languages)
|
||||||
# for each document
|
# for each document
|
||||||
for document in DOCUMENTS:
|
for document in DOCUMENTS:
|
||||||
|
# display language
|
||||||
|
print()
|
||||||
|
print(document[language])
|
||||||
# clean
|
# clean
|
||||||
os.chdir(directory)
|
os.chdir(directory)
|
||||||
wipe(tmp)
|
wipe(tmp)
|
||||||
|
@ -39,8 +48,10 @@ def build(directory, sign):
|
||||||
# move into document directory
|
# move into document directory
|
||||||
os.chdir(document[ENGLISH])
|
os.chdir(document[ENGLISH])
|
||||||
# prepare variables
|
# prepare variables
|
||||||
variables = {'mainlanguage': language,
|
variables = {
|
||||||
}
|
'mainlanguage': language,
|
||||||
|
'otherlanguages': other_languages,
|
||||||
|
}
|
||||||
# transform variables
|
# transform variables
|
||||||
variables = ''.join([f'\\def\\{k}{{{v}}}'
|
variables = ''.join([f'\\def\\{k}{{{v}}}'
|
||||||
for k, v in variables.items()])
|
for k, v in variables.items()])
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
% begin document
|
% begin document
|
||||||
\begin{document}
|
\begin{document}
|
||||||
|
|
||||||
\bi{}{}
|
\ml{}{}
|
||||||
|
|
||||||
\bi{Hello world!}{}
|
\ml{Hello world!}{}
|
||||||
|
|
||||||
\bi{}{Bonjour monde !}
|
\ml{}{Bonjour monde !}
|
||||||
|
|
||||||
\bi{Hello world!}{Bonjour monde !}
|
\ml{Hello world!}{Bonjour monde !}
|
||||||
|
|
||||||
% end document
|
% end document
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
|
|
||||||
% set languages
|
% set languages
|
||||||
\setmainlanguage{\mainlanguage}
|
\setmainlanguage{\mainlanguage}
|
||||||
\setotherlanguages{en,fr}
|
\setotherlanguages{\otherlanguages}
|
||||||
|
|
||||||
% language commands
|
% language commands
|
||||||
\newcommand{\ifstr}[4]{\expandafter\ifstrequal\expandafter{#1}{#2}{#3}{#4}}
|
\newcommand{\ifstr}[4]{\expandafter\ifstrequal\expandafter{#1}{#2}{#3}{#4}}
|
||||||
|
|
||||||
\newcommand{\bi}[2]{%
|
\newcommand{\ml}[2]{%
|
||||||
\ifstr{\mainlanguage}{en}{\ifstrempty{#1}{TRANSLATE\_ME!}{#1}}{%
|
\ifstr{\mainlanguage}{en}{\ifstrempty{#1}{TRANSLATE\_ME!}{#1}}{%
|
||||||
\ifstr{\mainlanguage}{fr}{\ifstrempty{#2}{TRADUISEZ\_MOI\_!}{#2}}{%
|
\ifstr{\mainlanguage}{fr}{\ifstrempty{#2}{TRADUISEZ\_MOI\_!}{#2}}{%
|
||||||
SHOULD\_NOT\_HAPPEN!%
|
SHOULD\_NOT\_HAPPEN!%
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue