\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 and . If you use only one language, just type your text within these tags: \begin{verbatim} English question \end{verbatim} If you want to offer your text with more than one language, use the \textbf{} tag within the / tag. Type your text for each language in a \textbf{} 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} English question Deutscher Aufgabentext Texte de la question en français English question \end{verbatim} Add a tag and the corresponding text for each additional language. Watch out to extend all 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} \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 tag within the 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 and \&languages()} If you use both, 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 tags within . \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 } Some old problems might contain the \textbf{} tag. This tag is deprecated and it is discouraged to use it. The functionality is different to . 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 by as described above.