Browse Source

moved hard-coded string to resources. Translated app to French.

yattoz 5 years ago
parent
commit
f82537aded

+ 4 - 2
app/src/main/java/fr/forum_thalie/tsumugi/Values.kt View File

5
 import kotlin.collections.ArrayList
5
 import kotlin.collections.ArrayList
6
 
6
 
7
 const val tag = "fr.forum_thalie.tsumugi"
7
 const val tag = "fr.forum_thalie.tsumugi"
8
-const val noConnectionValue = "Arrêté."
9
-const val streamDownValue = "Tsumugi est HS !"
8
+const val noConnectionValue = ""
9
+const val streamDownValue = "Tsumugi est HS !" // we don't want this value to be displaed in the "last played" screen.
10
 val weekdaysArray : Array<String> = arrayOf( "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche")
10
 val weekdaysArray : Array<String> = arrayOf( "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche")
11
 
11
 
12
+// Below this line is only automatically programmed values. Unless your week does not start with Monday, you don't need to change this.
13
+
12
 val weekdays = ArrayList<String>().apply { weekdaysArray.forEach { add(it) } }
14
 val weekdays = ArrayList<String>().apply { weekdaysArray.forEach { add(it) } }
13
 val weekdaysSundayFirst = ArrayList<String>().apply {
15
 val weekdaysSundayFirst = ArrayList<String>().apply {
14
     weekdays.forEach {
16
     weekdays.forEach {

+ 2 - 1
app/src/main/java/fr/forum_thalie/tsumugi/planning/Planning.kt View File

4
 import androidx.lifecycle.MutableLiveData
4
 import androidx.lifecycle.MutableLiveData
5
 import fr.forum_thalie.tsumugi.Async
5
 import fr.forum_thalie.tsumugi.Async
6
 import fr.forum_thalie.tsumugi.R
6
 import fr.forum_thalie.tsumugi.R
7
+import fr.forum_thalie.tsumugi.noConnectionValue
7
 import fr.forum_thalie.tsumugi.weekdays
8
 import fr.forum_thalie.tsumugi.weekdays
8
 import org.json.JSONObject
9
 import org.json.JSONObject
9
 import java.io.IOException
10
 import java.io.IOException
26
             if (it.isCurrent())
27
             if (it.isCurrent())
27
                 return it.title
28
                 return it.title
28
         }
29
         }
29
-        return regularProgramme ?: "—"
30
+        return regularProgramme ?: noConnectionValue
30
     }
31
     }
31
 
32
 
32
     fun checkProgramme()
33
     fun checkProgramme()

+ 1 - 1
app/src/main/java/fr/forum_thalie/tsumugi/ui/nowplaying/NowPlayingFragment.kt View File

162
             if (sleepAtMillis != null)
162
             if (sleepAtMillis != null)
163
             {
163
             {
164
                 val duration = ((sleepAtMillis - System.currentTimeMillis()).toFloat() / (60f * 1000f) + 1).toInt() // I put 1 + it because the division rounds to the lower integer. I'd like to display the round up, like it's usually done.
164
                 val duration = ((sleepAtMillis - System.currentTimeMillis()).toFloat() / (60f * 1000f) + 1).toInt() // I put 1 + it because the division rounds to the lower integer. I'd like to display the round up, like it's usually done.
165
-                sleepInfoText.text = "Will close in $duration minute${if (duration > 1) "s" else ""}"
165
+                sleepInfoText.text = String.format(getString(R.string.willCloseIn), duration) // "Will close in $duration minute${if (duration > 1) "s" else ""}"
166
                 sleepInfoText.visibility = View.VISIBLE
166
                 sleepInfoText.visibility = View.VISIBLE
167
             } else {
167
             } else {
168
                 sleepInfoText.visibility = View.GONE
168
                 sleepInfoText.visibility = View.GONE

+ 68 - 0
app/src/main/res/values-fr/strings.xml View File

1
+<resources>
2
+    <string name="app_name">Tsumugi</string>
3
+    <string name="title_nowplaying">Tsumugi</string>
4
+    <string name="title_queue_lp">Titres</string>
5
+    <string name="title_chat">Chat</string>
6
+    <string name="title_news">Actus</string>
7
+    <string name="title_programme">Planning</string>
8
+
9
+    <string name="now_playing_notification_title_template">Maintenant: %1$s</string>
10
+
11
+    <string name="MEDIA_ROOT_ID">radio_root_id</string>
12
+    <string name="STREAM_URL_RADIO">https://relay0.r-a-d.io/main.mp3</string>
13
+    <string name="STREAM_URL_TSUMUGI">https://radio.mahoro-net.org/streams/tsumugi</string>
14
+    <string name="STREAM_URL_RSTLSS">http://stream.radiosolution.fr/rstlss.mp3</string>
15
+
16
+    <string name="volume">Volume : </string>
17
+
18
+    <string name="up_next">Émission en cours :</string>
19
+    <string name="now_streaming">En cours</string>
20
+    <string name="error_webView">Erreur du chargement de WebView. Téléchargez Google Chrome sur le Play Store, ou activez le si vous l\'avez désactivé.</string>
21
+    <string name="action_settings">Paramètres</string>
22
+    <string name="action_bug_submit">Reporter un bug (GitHub)</string>
23
+    <string name="github_url_new_issue">https://github.com/yattoz/Tsumugi-app/issues/</string>
24
+
25
+    <string name="nowPlayingNotificationChannel">Tsumugi Stream Service</string>
26
+    <string name="nowPlayingChannelId">fr.forum_thalie.tsumugi.PLAYER_SERVICE</string>
27
+
28
+    <string name="snackbarPersistent">Restent visibles, peuvent être fermées avec un bouton \"OK\" ou en glissant.</string>
29
+    <string name="snackbarNonPersistent">Disparaissent après quelques instants</string>
30
+    <string name="every_day">Tous les jours</string>
31
+    <string name="working_days">Semaine ouvrée</string>
32
+    <string name="song_to_clipboard">Titre copié dans le presse-papier !</string>
33
+    <string name="listeners">Auditeurs</string>
34
+    <string name="r_a_dio_icon">Icone de la radio</string>
35
+    <string name="split_layout">Divise l\'écran en 2 parties quand l\'appareil est à l\'horizontale</string>
36
+    <string name="not_split_layout">Garde la même disposition à l\'horizontale et à la verticale</string>
37
+    <string name="action_sleep">Minuterie avant fermeture</string>
38
+    <string name="dont_fetch_on_background">Désactiver</string>
39
+    <string name="restart_the_app">Vous devez redémarrer l\'application pour valider ces changements.</string>
40
+
41
+    <string name="action_alarm">Alarme</string>
42
+    <string name="sleep_fade_out_text">Une minute avant la fin de la minuterie, le volume va décroitre progressivement.</string>
43
+    <string name="disable">Désactiver</string>
44
+    <string name="website_url">https://tsumugi.forum-thalie.fr/</string>
45
+    <string name="rss_url">https://tsumugi.forum-thalie.fr/?feed=rss2</string>
46
+    <string name="planning_url">ADD SOME URL HERE</string>
47
+    <string name="select_one_day">Sélectionner au moins un jour.</string>
48
+    <string name="no_alarm_set">Pas d\'alarme</string>
49
+    <string name="next_alarm">Prochaine alarme :</string>
50
+    <string name="lp">Dernières titres</string>
51
+    <string name="programme">Planning</string>
52
+    <string name="regular_programme">Programme régulier</string>
53
+    <string name="useAlarmClock">Activer l\alarme</string>
54
+    <string name="setTime">Choisir l\'heure</string>
55
+    <string name="selectDaysOfWeek">Choisir les jours</string>
56
+    <string name="SetSnoozeDuration">Choisir le délai de snooze (minutes)</string>
57
+    <string name="volumeAtStartup">Volume au démarrage</string>
58
+    <string name="useHorizontalSplitLayout">Utiliser une disposition horizontale adaptée</string>
59
+    <string name="makeSnackbarsPersistent">Rendre les barres d\information persistantes</string>
60
+    <string name="setupAlarmClock">Configurer l\'alarme</string>
61
+    <string name="setSleepTimer">Configurer la minuterie avant extinction</string>
62
+    <string name="costumizeAppBehavior">Paramètres de l\'application</string>
63
+    <string name="submitABug">Reporter un bug</string>
64
+    <string name="sleepClosesApp">Minuterie avant fermeture de l\'application</string>
65
+    <string name="setSleepDuration">Choisir une durée (en minutes)</string>
66
+    <string name="willCloseIn">Extinction dans %1$d minutes</string>
67
+
68
+</resources>

+ 15 - 1
app/src/main/res/values/strings.xml View File

1
-<resources>
1
+<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
2
     <string name="app_name">Tsumugi</string>
2
     <string name="app_name">Tsumugi</string>
3
     <string name="title_nowplaying">Tsumugi</string>
3
     <string name="title_nowplaying">Tsumugi</string>
4
     <string name="title_queue_lp">Songs</string>
4
     <string name="title_queue_lp">Songs</string>
50
     <string name="lp">Last played</string>
50
     <string name="lp">Last played</string>
51
     <string name="programme">Planning</string>
51
     <string name="programme">Planning</string>
52
     <string name="regular_programme">Programme régulier</string>
52
     <string name="regular_programme">Programme régulier</string>
53
+    <string name="useAlarmClock">Use as alarm clock</string>
54
+    <string name="setTime">Set time</string>
55
+    <string name="selectDaysOfWeek">Select days of the week</string>
56
+    <string name="SetSnoozeDuration">Set snooze duration (minutes)</string>
57
+    <string name="volumeAtStartup">Volume at startup</string>
58
+    <string name="useHorizontalSplitLayout">Use horizontal split layout</string>
59
+    <string name="makeSnackbarsPersistent">Make Snackbars persistent</string>
60
+    <string name="setupAlarmClock">Set up alarm clock</string>
61
+    <string name="setSleepTimer">Set sleep timer</string>
62
+    <string name="costumizeAppBehavior">Customize app behavior</string>
63
+    <string name="submitABug">Submit a bug (opens GitHub in a web browser)</string>
64
+    <string name="sleepClosesApp">Sleep - close app after some time</string>
65
+    <string name="setSleepDuration">Set duration (minutes)</string>
66
+    <string name="willCloseIn">Will close in %1$d minutes</string>
53
 
67
 
54
 </resources>
68
 </resources>

+ 4 - 4
app/src/main/res/xml/alarm_preferences.xml View File

6
     <SwitchPreferenceCompat
6
     <SwitchPreferenceCompat
7
         app:key="isWakingUp"
7
         app:key="isWakingUp"
8
         app:iconSpaceReserved="false"
8
         app:iconSpaceReserved="false"
9
-        app:title="Use as alarm clock"
9
+        app:title="@string/useAlarmClock"
10
         app:singleLineTitle="false"
10
         app:singleLineTitle="false"
11
         app:defaultValue="false"
11
         app:defaultValue="false"
12
         />
12
         />
14
     <Preference
14
     <Preference
15
         app:key="timeSet"
15
         app:key="timeSet"
16
         app:iconSpaceReserved="false"
16
         app:iconSpaceReserved="false"
17
-        app:title="Set time"
17
+        app:title="@string/setTime"
18
         app:singleLineTitle="false"
18
         app:singleLineTitle="false"
19
         app:defaultValue="false"/>
19
         app:defaultValue="false"/>
20
 
20
 
21
     <MultiSelectListPreference
21
     <MultiSelectListPreference
22
         app:key="alarmDays"
22
         app:key="alarmDays"
23
         app:iconSpaceReserved="false"
23
         app:iconSpaceReserved="false"
24
-        app:title="Select days of the week"
24
+        app:title="@string/selectDaysOfWeek"
25
         app:singleLineTitle="false"
25
         app:singleLineTitle="false"
26
 
26
 
27
         />
27
         />
29
     <ListPreference
29
     <ListPreference
30
         app:key="snoozeDuration"
30
         app:key="snoozeDuration"
31
         app:iconSpaceReserved="false"
31
         app:iconSpaceReserved="false"
32
-        android:title="Set snooze duration (minutes)"
32
+        android:title="@string/SetSnoozeDuration"
33
         app:singleLineTitle="false"
33
         app:singleLineTitle="false"
34
         android:entries="@array/snoozeValues"
34
         android:entries="@array/snoozeValues"
35
         android:entryValues="@array/snoozeValues"
35
         android:entryValues="@array/snoozeValues"

+ 3 - 3
app/src/main/res/xml/customize_preferences.xml View File

5
     <SeekBarPreference
5
     <SeekBarPreference
6
         app:key="volume"
6
         app:key="volume"
7
         app:iconSpaceReserved="false"
7
         app:iconSpaceReserved="false"
8
-        app:title="Volume at startup"
8
+        app:title="@string/volumeAtStartup"
9
         app:singleLineTitle="false"
9
         app:singleLineTitle="false"
10
         app:min="0"
10
         app:min="0"
11
         android:max="100"
11
         android:max="100"
16
     <SwitchPreferenceCompat
16
     <SwitchPreferenceCompat
17
         app:key="splitLayout"
17
         app:key="splitLayout"
18
         app:iconSpaceReserved="false"
18
         app:iconSpaceReserved="false"
19
-        app:title="Use horizontal split layout"
19
+        app:title="@string/useHorizontalSplitLayout"
20
         app:singleLineTitle="false"
20
         app:singleLineTitle="false"
21
         app:defaultValue="true"
21
         app:defaultValue="true"
22
         />
22
         />
24
     <SwitchPreferenceCompat
24
     <SwitchPreferenceCompat
25
         app:key="snackbarPersistent"
25
         app:key="snackbarPersistent"
26
         app:iconSpaceReserved="false"
26
         app:iconSpaceReserved="false"
27
-        app:title="Make Snackbars persistent"
27
+        app:title="@string/makeSnackbarsPersistent"
28
         app:singleLineTitle="false"
28
         app:singleLineTitle="false"
29
         app:defaultValue="false"
29
         app:defaultValue="false"
30
         />
30
         />

+ 4 - 5
app/src/main/res/xml/preferences.xml View File

1
 <?xml version="1.0" encoding="utf-8"?>
1
 <?xml version="1.0" encoding="utf-8"?>
2
 <PreferenceScreen
2
 <PreferenceScreen
3
-    xmlns:android="http://schemas.android.com/apk/res/android"
4
     xmlns:app="http://schemas.android.com/apk/res-auto"
3
     xmlns:app="http://schemas.android.com/apk/res-auto"
5
     >
4
     >
6
 
5
 
7
     <Preference
6
     <Preference
8
         app:icon="@drawable/ic_alarm"
7
         app:icon="@drawable/ic_alarm"
9
         app:key="alarmScreen"
8
         app:key="alarmScreen"
10
-        app:title="Set up alarm clock"
9
+        app:title="@string/setupAlarmClock"
11
         app:fragment="fr.forum_thalie.tsumugi.preferences.AlarmFragment"
10
         app:fragment="fr.forum_thalie.tsumugi.preferences.AlarmFragment"
12
         />
11
         />
13
 
12
 
14
     <Preference
13
     <Preference
15
         app:icon="@drawable/ic_av_timer"
14
         app:icon="@drawable/ic_av_timer"
16
         app:key="sleepScreen"
15
         app:key="sleepScreen"
17
-        app:title="Set sleep timer"
16
+        app:title="@string/setSleepTimer"
18
         app:fragment="fr.forum_thalie.tsumugi.preferences.SleepFragment"
17
         app:fragment="fr.forum_thalie.tsumugi.preferences.SleepFragment"
19
         />
18
         />
20
 
19
 
21
     <Preference
20
     <Preference
22
         app:icon="@drawable/ic_customize"
21
         app:icon="@drawable/ic_customize"
23
         app:key="CustomizeFragment"
22
         app:key="CustomizeFragment"
24
-        app:title="Customize app behavior"
23
+        app:title="@string/costumizeAppBehavior"
25
         app:fragment="fr.forum_thalie.tsumugi.preferences.CustomizeFragment"
24
         app:fragment="fr.forum_thalie.tsumugi.preferences.CustomizeFragment"
26
         />
25
         />
27
 
26
 
28
     <Preference
27
     <Preference
29
         app:key="submitBug"
28
         app:key="submitBug"
30
-        app:title="Submit a bug (opens GitHub in a web browser)"
29
+        app:title="@string/submitABug"
31
         app:icon="@drawable/ic_bug"
30
         app:icon="@drawable/ic_bug"
32
         />
31
         />
33
 
32
 

+ 2 - 2
app/src/main/res/xml/sleep_preference.xml View File

5
     <SwitchPreferenceCompat
5
     <SwitchPreferenceCompat
6
         app:key="isSleeping"
6
         app:key="isSleeping"
7
         app:iconSpaceReserved="false"
7
         app:iconSpaceReserved="false"
8
-        app:title="Sleep - close app after some time"
8
+        app:title="@string/sleepClosesApp"
9
         app:singleLineTitle="false"
9
         app:singleLineTitle="false"
10
         app:defaultValue="false"
10
         app:defaultValue="false"
11
         />
11
         />
13
     <EditTextPreference
13
     <EditTextPreference
14
         app:key="sleepDuration"
14
         app:key="sleepDuration"
15
         app:iconSpaceReserved="false"
15
         app:iconSpaceReserved="false"
16
-        app:title="Set duration (minutes)"
16
+        app:title="@string/setSleepDuration"
17
         app:singleLineTitle="false"
17
         app:singleLineTitle="false"
18
         app:defaultValue="15"
18
         app:defaultValue="15"
19
         />
19
         />