File:
[LON-CAPA] /
loncom /
html /
adm /
help /
tex /
Authoring_Multilingual_Problems.tex
Revision
1.4:
download - view:
text,
annotated -
select for diffs
Thu Apr 24 13:18:16 2014 UTC (10 years, 6 months ago) by
bisitz
Branches:
MAIN
CVS tags:
version_2_12_X,
version_2_11_X,
version_2_11_5_msu,
version_2_11_5,
version_2_11_4_uiuc,
version_2_11_4_msu,
version_2_11_4,
version_2_11_3_uiuc,
version_2_11_3_msu,
version_2_11_3,
version_2_11_2_uiuc,
version_2_11_2_msu,
version_2_11_2_educog,
version_2_11_2,
version_2_11_1,
version_2_11_0_RC3,
version_2_11_0,
HEAD
Use sections for sections
\label{Authoring_Multilingual_Problems}
\section*{How to write problems in different languages?}
LON-CAPA offers the optional possibility to create multilingual problems.
You can use different languages for the task text and also for the options and
all other texts shown to the student. LON-CAPA automatically finds the best
fitting language for the texts to show to your students.
\subsection*{Problem Template}
A good point to start is to select the template \textbf{Option Response -
Matching (multilingual)} when creating a new problem. You can see there how
to show texts and options in an optionresponse problem
\ref{Authoring_OptionResponse} in different languages. More details how to
write such problems as follows.
\subsection*{Different languages in a text block}
Text to show to students is surrounded by <startouttext /> and <endouttext>.
If you use only one language, just type your text within these tags:
\begin{verbatim}
<startouttext />
English question
<endouttext />
\end{verbatim}
If you want to offer your text with more than one language, use the
\textbf{<translated>} tag within the <startouttext> / <endouttext> tag. Type
your text for each language in a \textbf{<lang>} tag. Specify the language code
in the attribute ``which'', e.g. ``en'' for English or ``de'' for German.
When the problem is presented to your students, LON-CAPA will automatically
choose the best language fitting to the user's environment taking care of
personal preferences. Details see below.
Don't forget to always have a \textbf{default language} present. If the default
was missing and LON-CAPA didn't find any fitting language, no text at all would
be shown to the student. It is recommended to use English as default or -
depending on the field of application - the language which fits best in the
context where the problem will be likely used.
Example (three different languages and default):
\begin{verbatim}
<startouttext />
<translated>
<lang which="en">English question</lang>
<lang which="de">Deutscher Aufgabentext</lang>
<lang which="fr">Texte de la question en français</lang>
<lang which="default">English question</lang>
</translated>
<endouttext />
\end{verbatim}
Add a <lang> tag and the corresponding text for each additional language. Watch
out to extend all <translated> tags within this problem in this way to have a
consistent language for all texts in the problem.
\subsection*{Different languages in options, variables, etc.}
If you use a script block to create dynamic content and it contains text, the
\textbf{\&languages()} function is used to offer these texts in different
languages. This function can be called in different ways, see Script Functions
\ref{Problem_LON-CAPA_Functions}.
One way is to provide the language codes for the languages you like to support
in an anonymous array to the function and get back the best fitting language of
those. Use the returned language code to decide which text in which language
should be used.
Example:
\begin{verbatim}
<script type="loncapa/perl">
&bestlanguage = &languages(['en','de','fr']);
if ($bestlanguage eq 'de') {
$optiontext = 'rot';
} elsif ($bestlanguage eq 'fr') {
$optiontext = 'rouge';
} else { # 'en' and default
$optiontext = 'red';
}
</script>
\end{verbatim}
\subsection*{Interface language vs. problem language}
LON-CAPA supports various languages for the web interface, e.g. for menu items
and help files. These languages are not necessarily dependent on the languages
offered within problems. I.e. it is possible to have the web interface shown
in Chinese and a problem is shown in Turkish. However, the user's language
preference is considered when the interface is rendered and also when the best
fitting language for texts in a problem is chosen. Details see below.
\subsection*{Language Codes}
Some language codes which can be used in the <lang> tag within the <translated>
tag:
\begin{itemize}
\item ar - Arabic
\item de - German
\item en - English
\item es - Spanish
\item fa - Persian
\item fr - French
\item he - Hebrew
\item ja - Japanese
\item pt - Portuguese
\item ru - Russian
\item tr - Turkish
\item zh - Chinese (Simplified)
\end{itemize}
These languages are currently also available as interface language, see
Language \ref{Prefs_Language} in the User Preferences section.
You can use other languages in your problems.
\subsection*{Consistent language with <translated> and \&languages()}
If you use both, <translated> and \&languages(), in your problem, always make
sure to keep the languages synchronized. Use exactly the same language codes
for the \&languages() call like those used in the <lang> tags within
<translated>.
\subsection*{Testing multilingual problems}
You can temporarily change the language for a problem in the \emph{Problem
Testing} screen. Use the ``Language'' dropdown list to choose the language
to be used for testing and click \fbox{Change View}.
Note: Your own personal settings apply, including your browser settings (see
below).
\subsection*{Language hierarchy model in LON-CAPA}
LON-CAPA uses the best fitting language by considering the following settings
(if available), in the order as follows:
\begin{enumerate}
\item Overall default: English
\item Server setting (see Domain Configuration \ref{Domain_Configuration_LangTZAuth})
\item User's language preference(s) in the web browser (client side)
\item User preference: Language \ref{Prefs_Language}
\item Course setting (see Course Configuration \ref{Course_Prefs_Language})
\item Individual problem content (e.g. hard coded language)
\end{enumerate}
Example 1:
The server is set to French, the user's preference in LON-CAPA is set to
prefer Spanish, the problem is programmed to offer Portuguese and Spanish,
and the problem default language is German.
LON-CAPA shows this problem in Spanish to the student.
Example 2:
The server is set to French, the user's preference in LON-CAPA is set to
prefer Spanish, the problem is programmed to offer Turkish and Portuguese,
and the problem default language is German.
LON-CAPA shows this problem in French to the student.
Example 3:
The user's preference in LON-CAPA is set to prefer Spanish, the problem
is programmed to offer French and Portuguese, and the problem default language
is German.
LON-CAPA shows this problem in German to the student.
\subsection*{Legacy code with <languageblock>}
Some old problems might contain the \textbf{<languageblock>} tag. This tag is
deprecated and it is discouraged to use it. The functionality is different to
<translated>. It does not fully support the practical needs for offering
multilingual problems. If you adapt such a problem for your own purposes, it
is recommended to replace <languageblock> by <translated> as described above.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>