@@ -8,79 +8,122 @@ package be.scri.ui.screens.tutorial
88 * through a specific Scribe feature.
99 */
1010object TutorialContent {
11+
12+ private fun getLanguageName (languageCode : String ): String {
13+ return when (languageCode) {
14+ " en" -> " English"
15+ " es" -> " Spanish"
16+ " fr" -> " French"
17+ " it" -> " Italian"
18+ " pt" -> " Portuguese"
19+ " ru" -> " Russian"
20+ " sv" -> " Swedish"
21+ else -> " German"
22+ }
23+ }
24+
1125 /* *
1226 * Chapter 1: Noun Annotation.
1327 * Teaches users about gender tags that appear when typing nouns.
1428 */
15- val nounAnnotationSteps =
16- listOf (
29+ fun getNounAnnotationSteps (languageCode : String ): List <TutorialStep > {
30+ val language = getLanguageName(languageCode)
31+ val (fatherWord, fatherTag, fatherGender) = when (languageCode) {
32+ " en" -> Triple (" father" , " M" , " Masculine" )
33+ " es" -> Triple (" padre" , " M" , " Masculino" )
34+ " fr" -> Triple (" père" , " M" , " Masculin" )
35+ " it" -> Triple (" padre" , " M" , " Maschile" )
36+ " pt" -> Triple (" pai" , " M" , " Masculino" )
37+ " ru" -> Triple (" отец" , " M" , " Мужской" )
38+ " sv" -> Triple (" far" , " C" , " Common" )
39+ else -> Triple (" Vater" , " M" , " Maskulin" )
40+ }
41+
42+ val (motherWord, motherTag, motherGender) = when (languageCode) {
43+ " en" -> Triple (" mother" , " F" , " Feminine" )
44+ " es" -> Triple (" madre" , " F" , " Femenino" )
45+ " fr" -> Triple (" mère" , " F" , " Féminin" )
46+ " it" -> Triple (" madre" , " F" , " Femminile" )
47+ " pt" -> Triple (" mãe" , " F" , " Feminino" )
48+ " ru" -> Triple (" мать" , " F" , " Женский" )
49+ " sv" -> Triple (" mor" , " C" , " Common" )
50+ else -> Triple (" Mutter" , " F" , " Feminin" )
51+ }
52+
53+ return listOf (
1754 TutorialStep (
1855 instruction =
19- " Write the word \" Vater \" . Notice the word suggestions " +
56+ " Write the word \" $fatherWord \" . Notice the word suggestions " +
2057 " that appear on the keyboard's top bar.\n\n " +
2158 " Then, press space. You will see the word's gender " +
22- " tag on the keyboard's top bar \u2013 in this case, \" M\" for Maskulin." ,
23- expectedWord = " Vater" ,
59+ " tag on the keyboard's top bar \u2013 in this case, \" $fatherTag \" for $fatherGender ." ,
60+ hint = " If your second language is not $language , change the language in your keyboard." ,
61+ expectedWord = fatherWord,
2462 ),
2563 TutorialStep (
2664 instruction =
27- " Now write the word \" Mutter\" and then press space. " +
28- " The gender tag will be \" F\" , for Feminin." ,
29- expectedWord = " Mutter" ,
65+ " Now write the word \" $motherWord \" and then press space. " +
66+ " The gender tag will be \" $motherTag \" , for $motherGender ." ,
67+ hint = " If your second language is not $language , change the language in your keyboard." ,
68+ expectedWord = motherWord,
3069 ),
3170 )
71+ }
3272
3373 /* *
3474 * Chapter 2: Word Translation.
3575 * Teaches users how to use the Translate command via the Scribe key.
3676 */
37- val wordTranslationSteps =
38- listOf (
77+ fun wordTranslationSteps (languageCode : String ): List <TutorialStep >{
78+ val language = getLanguageName(languageCode)
79+ return listOf (
3980 TutorialStep (
4081 instruction =
4182 " Let's translate! Tap the \u27A1 Scribe key on the top-left " +
4283 " corner of your keyboard, and select \u00DC bersetzen.\n\n " +
4384 " Then write the word you want to translate, press \u25B6 , " +
4485 " and the translation will be returned to you." ,
45- hint = " If your second language is not German , change the language in your keyboard." ,
86+ hint = " If your second language is not $language , change the language in your keyboard." ,
4687 requiresValidation = false ,
4788 ),
48- )
89+ )}
4990
50- val verbConjugationSteps =
51- listOf (
91+ fun verbConjugationSteps (languageCode : String ) : List <TutorialStep >{
92+ val language = getLanguageName(languageCode)
93+ return listOf (
5294 TutorialStep (
5395 instruction =
5496 " On to the verbs. Tap the \u27A1 Scribe key on the top-left " +
5597 " corner of your keyboard, and select Konjugieren.\n\n " +
5698 " Write the verb you want to conjugate, press \u25B6 , and " +
5799 " you will see a table with all the verb tenses. Select " +
58100 " the one you need and it will be inserted!" ,
59- hint = " If your second language is not German , change the language in your keyboard." ,
101+ hint = " If your second language is not $language , change the language in your keyboard." ,
60102 requiresValidation = false ,
61103 ),
62- )
104+ )}
63105
64- val nounPluralsSteps =
65- listOf (
106+ fun nounPluralsSteps (languageCode : String ) : List <TutorialStep > {
107+ val language = getLanguageName(languageCode)
108+ return listOf (
66109 TutorialStep (
67110 instruction =
68111 " Finding the plural of a noun with Scribe is easy. Tap " +
69112 " the \u27A1 Scribe key on the top-left corner of your " +
70113 " keyboard, and select Plural.\n\n " +
71114 " Then write the noun you want the plural for, press " +
72115 " \u25B6 , and the plural will be returned to you." ,
73- hint = " If your second language is not German , change the language in your keyboard." ,
116+ hint = " If your second language is not $language , change the language in your keyboard." ,
74117 requiresValidation = false ,
75118 ),
76- )
119+ )}
77120
78121 /* * Returns all chapters as a list of pairs (title, steps). */
79- fun getAllChapters (): List <Pair <String , List <TutorialStep >>> =
122+ fun getAllChapters (languageCode : String = "de" ): List <Pair <String , List <TutorialStep >>> =
80123 listOf (
81- " Noun annotation" to nounAnnotationSteps ,
82- " Word translation" to wordTranslationSteps,
83- " Verb conjugation" to verbConjugationSteps,
84- " Noun plurals" to nounPluralsSteps,
124+ " Noun annotation" to getNounAnnotationSteps(languageCode) ,
125+ " Word translation" to wordTranslationSteps(languageCode) ,
126+ " Verb conjugation" to verbConjugationSteps(languageCode) ,
127+ " Noun plurals" to nounPluralsSteps(languageCode) ,
85128 )
86129}
0 commit comments