{
base.OnAttachedTo(bindable);
_extendedSwitch = bindable as ExtendedSwitch;
+
if (_extendedSwitch != null)
{
_extendedSwitch.Toggled += ExtendedSwitchOnToggled;
--- /dev/null
+/*
+* Copyright 2018 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.1 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://floralicense.org/license/
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+using Clock.Model;
+using Clock.Tizen.Mobile.Translation;
+using System;
+using System.Globalization;
+using System.Text;
+using Xamarin.Forms;
+using System.Linq;
+
+namespace Clock.Tizen.Mobile.Tools.Converters
+{
+ class DaysOfWeekToStringConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var ret = new StringBuilder();
+
+ if (value is DaysOfWeek daysOfWeek)
+ {
+ if (Enum.GetValues(typeof(DaysOfWeek)).Cast<DaysOfWeek>().All(e => daysOfWeek.HasFlag(e)))
+ {
+ return TranslationService.GetTranslation("IDS_ALM_BODY_EVERYDAY");
+ }
+ if (daysOfWeek == DaysOfWeek.Never)
+ {
+ return TranslationService.GetTranslation("IDS_CLOCK_MBODY_NEVER");
+ }
+
+ if (daysOfWeek.HasFlag(DaysOfWeek.Sunday))
+ {
+ ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_SUN_ABB2")} ");
+ }
+ if (daysOfWeek.HasFlag(DaysOfWeek.Monday))
+ {
+ ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_MON_ABB2")} ");
+ }
+ if (daysOfWeek.HasFlag(DaysOfWeek.Tuesday))
+ {
+ ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_TUE_ABB2")} ");
+ }
+ if (daysOfWeek.HasFlag(DaysOfWeek.Wednesday))
+ {
+ ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_WED_ABB2")} ");
+ }
+ if (daysOfWeek.HasFlag(DaysOfWeek.Thursday))
+ {
+ ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_THU_ABB2")} ");
+ }
+ if (daysOfWeek.HasFlag(DaysOfWeek.Friday))
+ {
+ ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_FRI_ABB2")} ");
+ }
+ if (daysOfWeek.HasFlag(DaysOfWeek.Saturday))
+ {
+ ret.Append($"{TranslationService.GetTranslation("IDS_CLOCK_SBODY_SAT_ABB2")} ");
+ }
+ }
+
+ return ret.ToString();
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
}
/// <summary>
+ /// Looks up a localized string similar to Never.
+ /// </summary>
+ internal static string IDS_CLOCK_MBODY_NEVER {
+ get {
+ return ResourceManager.GetString("IDS_CLOCK_MBODY_NEVER", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Fri.
+ /// </summary>
+ internal static string IDS_CLOCK_SBODY_FRI_ABB2 {
+ get {
+ return ResourceManager.GetString("IDS_CLOCK_SBODY_FRI_ABB2", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Mon.
+ /// </summary>
+ internal static string IDS_CLOCK_SBODY_MON_ABB2 {
+ get {
+ return ResourceManager.GetString("IDS_CLOCK_SBODY_MON_ABB2", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Sat.
+ /// </summary>
+ internal static string IDS_CLOCK_SBODY_SAT_ABB2 {
+ get {
+ return ResourceManager.GetString("IDS_CLOCK_SBODY_SAT_ABB2", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Sun.
+ /// </summary>
+ internal static string IDS_CLOCK_SBODY_SUN_ABB2 {
+ get {
+ return ResourceManager.GetString("IDS_CLOCK_SBODY_SUN_ABB2", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Thu.
+ /// </summary>
+ internal static string IDS_CLOCK_SBODY_THU_ABB2 {
+ get {
+ return ResourceManager.GetString("IDS_CLOCK_SBODY_THU_ABB2", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Tue.
+ /// </summary>
+ internal static string IDS_CLOCK_SBODY_TUE_ABB2 {
+ get {
+ return ResourceManager.GetString("IDS_CLOCK_SBODY_TUE_ABB2", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Wed.
+ /// </summary>
+ internal static string IDS_CLOCK_SBODY_WED_ABB2 {
+ get {
+ return ResourceManager.GetString("IDS_CLOCK_SBODY_WED_ABB2", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Time is up.
/// </summary>
internal static string IDS_TMR_POP_TIME_IS_UP {
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="IDS_ALM_BODY_EVERYDAY" xml:space="preserve">
+ <value>Tous les jours</value>
+ </data>
<data name="IDS_ALM_BODY_SOUND" xml:space="preserve">
<value>Son</value>
</data>
<data name="IDS_CLOCK_BODY_WORLD_CLOCK" xml:space="preserve">
<value>Horloge mondiale</value>
</data>
+ <data name="IDS_CLOCK_BUTTON_EDIT_ABB4" xml:space="preserve">
+ <value>Modif.</value>
+ </data>
+ <data name="IDS_CLOCK_HEADER_CREATE" xml:space="preserve">
+ <value>Créer</value>
+ </data>
+ <data name="IDS_CLOCK_HEADER_HOURS" xml:space="preserve">
+ <value>Heures</value>
+ </data>
+ <data name="IDS_CLOCK_HEADER_MINUTES" xml:space="preserve">
+ <value>Minutes</value>
+ </data>
+ <data name="IDS_CLOCK_HEADER_SECONDS" xml:space="preserve">
+ <value>Secondes</value>
+ </data>
+ <data name="IDS_CLOCK_MBODY_NEVER" xml:space="preserve">
+ <value>Jamais</value>
+ </data>
+ <data name="IDS_TMR_POP_TIME_IS_UP" xml:space="preserve">
+ <value>Temps écoulé</value>
+ </data>
</root>
\ No newline at end of file
<data name="IDS_CLOCK_HEADER_SECONDS" xml:space="preserve">
<value>Seconds</value>
</data>
+ <data name="IDS_CLOCK_MBODY_NEVER" xml:space="preserve">
+ <value>Never</value>
+ </data>
+ <data name="IDS_CLOCK_SBODY_FRI_ABB2" xml:space="preserve">
+ <value>Fri</value>
+ </data>
+ <data name="IDS_CLOCK_SBODY_MON_ABB2" xml:space="preserve">
+ <value>Mon</value>
+ </data>
+ <data name="IDS_CLOCK_SBODY_SAT_ABB2" xml:space="preserve">
+ <value>Sat</value>
+ </data>
+ <data name="IDS_CLOCK_SBODY_SUN_ABB2" xml:space="preserve">
+ <value>Sun</value>
+ </data>
+ <data name="IDS_CLOCK_SBODY_THU_ABB2" xml:space="preserve">
+ <value>Thu</value>
+ </data>
+ <data name="IDS_CLOCK_SBODY_TUE_ABB2" xml:space="preserve">
+ <value>Tue</value>
+ </data>
+ <data name="IDS_CLOCK_SBODY_WED_ABB2" xml:space="preserve">
+ <value>Wed</value>
+ </data>
<data name="IDS_TMR_POP_TIME_IS_UP" xml:space="preserve">
<value>Time is up</value>
</data>
using System.Globalization;
using System.Reflection;
using System.Resources;
+using System.Threading;
using Clock.Abstractions;
using Clock.Data;
using Tizen;
private void ChangeAppLanguage()
{
+ Thread.CurrentThread.CurrentUICulture = _cultureInfo;
var resourceSet = _resourceManager.Value.GetResourceSet(_cultureInfo, true, true);
foreach (DictionaryEntry entry in resourceSet)
{
xmlns:controls="clr-namespace:Clock.Tizen.Mobile.Controls;assembly=Clock.Tizen.Mobile"
xmlns:behaviors="clr-namespace:Clock.Tizen.Mobile.Behaviors;assembly=Clock.Tizen.Mobile"
xmlns:converters="clr-namespace:Clock.Tools.Converters;assembly=Clock"
+ xmlns:nativeConverters="clr-namespace:Clock.Tizen.Mobile.Tools.Converters;assembly=Clock.Tizen.Mobile"
xmlns:generic="clr-namespace:System.Collections.Generic;assembly=System.Collections"
xmlns:views="clr-namespace:Clock.Tizen.Mobile.Views;assembly=Clock.Tizen.Mobile"
xmlns:popups="clr-namespace:Clock.Tizen.Mobile.Controls.Popups;assembly=Clock.Tizen.Mobile"
<converters:VolumeLevelToBoolConverter x:Key="VolumeLevelToBoolConverter" />
<converters:AlarmTypeToBoolConverter x:Key="AlarmTypeToBoolConverter" />
<converters:AlarmTypeToSoundIconOpacityConverter x:Key="AlarmTypeToSoundIconOpacityConverter" />
- <converters:VolumeLevelConverter x:Key="VolumeLevelConverter"/>
+ <converters:VolumeLevelConverter x:Key="VolumeLevelConverter" />
+ <nativeConverters:DaysOfWeekToStringConverter x:Key="DaysOfWeekToStringConverter" />
<DataTemplate x:Key="timeEditTemplate">
<ViewCell Height="474">
<AbsoluteLayout>
<DataTemplate x:Key="repeatEditTemplate">
<controls:TextCell PrimaryText="Repeat weekly"
- SecondaryText="{Binding Source={x:Reference Root}, Path=BindingContext.ViewModel.Recurrence}"
+ SecondaryText="{Binding Source={x:Reference Root}, Path=BindingContext.ViewModel.Recurrence, Converter={StaticResource DaysOfWeekToStringConverter}}"
Command="{Binding Source={x:Reference Root}, Path=BindingContext.NavigateToAlarmRecurrenceSetPageCommand}" />
</DataTemplate>
private void TranslationServiceOnLanguageChanged(object sender, EventArgs e)
{
+ ViewModel.TriggerUpdate();
OnLanguageChanged();
}