Annotation of loncom/html/adm/help/tex/Authoring_Multilingual_Problems.tex, revision 1.1
1.1 ! bisitz 1: \label{Authoring_Multilingual}
! 2: \textbf{How to write problems in different languages?}
! 3:
! 4: LON-CAPA offers the optional possibility to create multilingual problems.
! 5: You can use different languages for the task text and also for the options and
! 6: all other texts shown to the student. LON-CAPA automatically finds the best
! 7: fitting language for the texts to show to your students.
! 8:
! 9:
! 10: \textbf{Problem Template}
! 11:
! 12: A good point to start is to select the template \textbf{Option Response -
! 13: Matching (multilingual)} when creating a new problem. You can see there how
! 14: to show texts and options in an optionresponse problem
! 15: \ref{Authoring_OptionResponse} in different languages. More details how to
! 16: write such problems as follows.
! 17:
! 18:
! 19: \textbf{Different languages in a text block}
! 20:
! 21: Text to show to students is surrounded by <startouttext /> and <endouttext>.
! 22: If you use only one language, just type your text within these tags:
! 23:
! 24: \begin{verbatim}
! 25: <startouttext />
! 26: English question
! 27: <endouttext />
! 28: \end{verbatim}
! 29:
! 30: If you want to offer your text with more than one language, use the
! 31: \textbf{<translated>} tag within the <startouttext> / <endouttext> tag. Type
! 32: your text for each language in a \textbf{<lang>} tag. Specify the language code
! 33: in the attribute ``which'', e.g. ``en'' for English or ``de'' for German.
! 34: When the problem is presented to your students, LON-CAPA will automatically
! 35: choose the best language fitting to the user's environment taking care of
! 36: personal preferences. Details see below.
! 37:
! 38: Don't forget to always have a \textbf{default language} present. If the default
! 39: was missing and LON-CAPA didn't find any fitting language, no text at all would
! 40: be shown to the student. It is recommended to use English as default or -
! 41: depending on the field of application - the language which fits best in the
! 42: context where the problem will be likely used.
! 43:
! 44: Example (three different languages and default):
! 45: \begin{verbatim}
! 46: <startouttext />
! 47: <translated>
! 48: <lang which="en">English question</lang>
! 49: <lang which="de">Deutscher Aufgabentext</lang>
! 50: <lang which="fr">Texte de la question en français</lang>
! 51: <lang which="default">English question</lang>
! 52: </translated>
! 53: <endouttext />
! 54: \end{verbatim}
! 55:
! 56: Add a <lang> tag and the corresponding text for each additional language. Watch
! 57: out to extend all <translated> tags within this problem in this way to have a
! 58: consistent language for all texts in the problem.
! 59:
! 60:
! 61: \textbf{Interface language vs. problem language}
! 62:
! 63: LON-CAPA supports various languages for the web interface, e.g. for menu items
! 64: and help files. These languages are not necessarily dependent on the languages
! 65: offered within problems. I.e. it is possible to have the web interface shown
! 66: in Chinese and a problem is shown in Turkish. However, the user's language
! 67: preference is considered when the interface is rendered and also when the best
! 68: fitting language for texts in a problem is chosen. Details see below.
! 69:
! 70:
! 71: \textbf{Language Codes}
! 72:
! 73: Some language codes which can be used in the <lang> tag within the <translated>
! 74: tag:
! 75: \begin{itemize}
! 76: \item ar - Arabic
! 77: \item de - German
! 78: \item en - English
! 79: \item es - Spanish
! 80: \item fa - Persian
! 81: \item fr - French
! 82: \item he - Hebrew
! 83: \item ja - Japanese
! 84: \item pt - Portuguese
! 85: \item ru - Russian
! 86: \item tr - Turkish
! 87: \item zh - Chinese (Simplified)
! 88: \end{itemize}
! 89:
! 90: These languages are currently also available as interface language, see
! 91: Language \ref{Prefs_Language} in the User Preferences section.
! 92: You can use other languages in your problems.
! 93:
! 94:
! 95: \textbf{Different languages in options, variables, etc.}
! 96:
! 97: If you use a script block to create dynamic content and it contains text, the
! 98: \textbf{\&languages()} function is used to offer these texts in different
! 99: languages. This function can be called in different ways, see Script Functions
! 100: \ref{Problem_LON-CAPA_Functions}.
! 101: One way is to provide the language codes for the languages you like to support
! 102: in an anonymous array to the function and get back the best fitting language of
! 103: those. Use the returned language code to decide which text in which language
! 104: should be used.
! 105:
! 106: Example:
! 107: \begin{verbatim}
! 108: <script type="loncapa/perl">
! 109: &bestlanguage = &languages(['en','de','fr']);
! 110: if ($bestlanguage eq 'de') {
! 111: $optiontext = 'rot';
! 112: } elsif ($bestlanguage eq 'fr') {
! 113: $optiontext = 'rouge';
! 114: } else { # 'en' and default
! 115: $optiontext = 'red';
! 116: }
! 117: </script>
! 118: \end{verbatim}
! 119:
! 120:
! 121: \textbf{Consistent language with <translated> and \&languages()}
! 122:
! 123: If you use both, <translated> and \&languages(), in your problem, always make
! 124: sure to keep the languages synchronized. Use exactly the same language codes
! 125: for the \&languages() call like those used in the <lang> tags within
! 126: <translated>.
! 127:
! 128: \textbf{Testing multilingual problems}
! 129:
! 130: You can temporarily change the language for a problem in the \emph{Problem
! 131: Testing} screen. Use the ``Language'' dropdown list to choose the language
! 132: to be used for testing and click \fbox{Change View}.
! 133:
! 134: Note: Your own personal settings apply, including your browser settings (see
! 135: below).
! 136:
! 137:
! 138: \textbf{Language hierarchy model in LON-CAPA}
! 139:
! 140: LON-CAPA uses the best fitting language by considering the following settings
! 141: (if available), in the order as follows:
! 142: \begin{enumerate}
! 143: \item Overall default: English
! 144: \item Server setting (see Domain Configuration \ref{Domain_Configuration_LangTZAuth})
! 145: \item User's language preference(s) in the web browser (client side)
! 146: \item User preference: Language \ref{Prefs_Language}
! 147: \item Course setting (see Course Configuration \ref{Course_Prefs_Language})
! 148: \item Individual problem content (e.g. hard coded language)
! 149: \end{enumerate}
! 150:
! 151: Example 1:
! 152:
! 153: The server is set to French, the user's preference in LON-CAPA is set to
! 154: prefer Spanish, the problem is programmed to offer Portuguese ans Spanish,
! 155: and the problem default language is German.
! 156: LON-CAPA shows this problem in Spanish to the student.
! 157:
! 158: Example 2:
! 159:
! 160: The server is set to French, the user's preference in LON-CAPA is set to
! 161: prefer Spanish, the problem is programmed to offer Turkish and Portuguese,
! 162: and the problem default language is German.
! 163: LON-CAPA shows this problem in French to the student.
! 164:
! 165: Example 3:
! 166:
! 167: The user's preference in LON-CAPA is set to prefer Spanish, the problem
! 168: is programmed to offer French and Portuguese, and the problem default language
! 169: is German.
! 170: LON-CAPA shows this problem in German to the student.
! 171:
! 172:
! 173: \textbf{Legacy code with <languageblock>}
! 174:
! 175: Some old problems might contain the \textbf{<languageblock>} tag. This tag is
! 176: deprecated and it is discouraged to use it. The functionality is different to
! 177: <translated>. It does not fully support the practical needs for offering
! 178: multilingual problems. If you adapt such a problem for your own purposes, it
! 179: is recommended to replace <languageblock> by <translated> as described above.
! 180:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>