public void Refresh() { keysInit = true; UpdateArrays(); Repaint(); Localizator.RefreshAll(); }
private async void LoadVideo() { LoadingIndicator.IsBusy = true; try { var response = await ServiceLocator.Vkontakte.Video.Get(new[] { $"{_videoAttachment.OwnerId}_{_videoAttachment.Id}_{_videoAttachment.AccessKey}" }); if (response != null && !response.Items.IsNullOrEmpty()) { var video = response.Items.First(); WebView.Navigate(new Uri(video.Player)); } else { LoadingIndicator.Error = Localizator.String("Error/ChatVideoAttachmentLoadCommonError"); LoadingIndicator.IsBusy = false; } } catch (Exception ex) { Logger.Error(ex, $"Unable to load video {_videoAttachment.OwnerId}_{_videoAttachment.Id}_{_videoAttachment.AccessKey} info"); LoadingIndicator.Error = Localizator.String("Error/ChatVideoAttachmentLoadCommonError"); LoadingIndicator.IsBusy = false; } }
private void VisualizeNewReplica(Replica_Switch context) { _replica.text = Localizator.GetText(context.Replica.TextId); var data = _charactersData.GetCharacter(context.Replica.CharacterId); _character.sprite = data.Icon; }
private void ShowTestTranslationsButtons() { DrawSpace(1); EditorGUILayout.LabelField("Changing language", EditorStyles.boldLabel); var popupStyle = GUI.skin.GetStyle("Popup"); popupStyle.fontSize = 11; EditorGUILayout.BeginHorizontal(); selectedLanguageIndex = EditorGUILayout.Popup(selectedLanguageIndex, cashLanguages, popupStyle); if (GUILayout.Button("Set selected language")) { Localizator.ChangeLanguage(selectedLanguageIndex); } EditorGUILayout.EndHorizontal(); DrawSpace(1); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Set next language")) { Localizator.ChangeLanguage(); } if (GUILayout.Button("Set default language")) { Localizator.SetDefaultLanguage(); } EditorGUILayout.EndHorizontal(); }
private async void Load() { var friends = new List <VkProfile>(); //try //{ // var response = await ServiceLocator.Vkontakte.Friends.Get(0, "first_name,last_name,photo,online,last_seen", null, 7, 0, FriendsOrder.ByRating); // if (response != null) // friends.AddRange(response.Items); //} //catch (Exception ex) //{ // Logger.Error(ex, "Unable to load friends"); //} var t = TaskStarted("users"); try { var response = await ServiceLocator.Vkontakte.Friends.Get(0, "first_name,last_name,photo,online,last_seen", null, 0, 0, _selectedSortTypeIndex != 0?FriendsOrder.ByName : FriendsOrder.ByRating); if (response != null && !response.Items.IsNullOrEmpty()) { friends.AddRange(response.Items); } else { t.Error = Localizator.String("NewDialogFriendsEmptyError"); } } catch (Exception ex) { Logger.Error(ex, "Unable to load friends"); t.Error = Localizator.String("NewDialogFriendsCommonError"); } Friends = friends; if (_selectedSortTypeIndex != 0) { FriendsCollection = new CollectionViewSource() { Source = _friends.ToAlphaGroups(f => _selectedSortTypeIndex == 1 ? f.FirstName : f.LastName), ItemsPath = new PropertyPath("Value"), IsSourceGrouped = true }; } else { FriendsCollection = new CollectionViewSource() { Source = _friends, IsSourceGrouped = false }; } t.Finish(); }
private void UpdateCountTitle() { var locale = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName; MessagesCountTitle.Text = StringHelper.LocalizeNumerals(Attachment.Messages.Count, Localizator.String("MessagesSingular"), Localizator.String("MessagesDual"), Localizator.String("MessagesPlural"), locale).ToLower(); }
internal static void Prepare(Dictionary <string, object>[] res) { resources = Localizator.CreateResources(new Dictionary <string, object>[][] { res, Common.Engineering.Localization.Utils.ControlUtilites.Resources, Common.UI.Resources.Utils.ControlUtilites.Resources }); }
public AppVM() { UIElementClickedCommand = new RelayCommand(new Action <object>(UIElementClicked)); HamburgerClickedCommand = new RelayCommand(new Action <object>(HamburgerClicked)); SearchClickedCommand = new RelayCommand(new Action <object>(SearchClicked)); CurrentLocalization = Localizator.Initializing(); InitializingModels(); }
public void UpdateArrays() { Localizator.RefreshAll(); keys = Localizator.GetKeysArray(); Array.Sort(keys); currentLanguages = Localizator.GetAvailableLanguages(); Search("", ignoreRepetition: true); FilterKeys(); }
protected override void MyAwake() { Localizator.Init(); _intersctObjects.Init(_boy); _dialogSwitcher.Init(new ChoiceChecker()); var dialogRequester = new DialogRequester(_dialogSwitcher); _dialogVisualization.Init(_dialogSwitcher); _storyteller.Init(dialogRequester, _gameModel); }
public Main() { InitializeComponent(); cancelTokenSource = new CancellationTokenSource(); token = cancelTokenSource.Token; localizator = new Localizator(configManager.CurrentConfig.Locale); hardwareLibrary = new HardwareLibrary(MessageManager.MessageHandler, ErrorHandler, EventHandler, configManager.CurrentConfig.LogEnable); }
public void UpdateLang() { if (lngSwitch.isOn) { Localizator.UpdateLanguage(SystemLanguage.Turkish); } else { Localizator.UpdateLanguage(SystemLanguage.English); } }
private async void Load() { var t = TaskStarted("dialogs"); try { var vkDialogs = await ServiceLocator.Vkontakte.Messages.GetDialogs(); if (!vkDialogs.Items.IsNullOrEmpty()) { var dialogs = await ProcessDialogs(vkDialogs.Items); _totalCount = vkDialogs.TotalCount; Dialogs = new IncrementalLoadingCollection <Dialog>(dialogs); Dialogs.HasMoreItemsRequested = () => _totalCount > Dialogs.Count; Dialogs.OnMoreItemsRequested = LoadMoreDialogs; if (((App)Application.Current).LaunchArgs != null) { var args = ((App)Application.Current).LaunchArgs; if (args != null && args.ContainsKey("uid")) { long uid = long.Parse(args["uid"]); var activeDialog = Dialogs.FirstOrDefault(d => d.User.Profile.Id == uid); SelectedDialog = activeDialog; } } } else { t.Error = Localizator.String("Errors/DialogsEmptyError"); } } catch (VkInvalidTokenException) { Messenger.Default.Send(new LoginStateChangedMessage() { IsLoggedIn = false }); Navigator.Main.Navigate(typeof(LoginView), clearHistory: true); } catch (Exception ex) { Logger.Error(ex, "Unable to load dialogs"); t.Error = Localizator.String("Errors/DialogsCommonError"); } t.Finish(); }
private void ShowParsingInfo() { DrawSpace(1); var italicStyle = new GUIStyle(GUI.skin.GetStyle("Label")); italicStyle.fontStyle = FontStyle.Italic; italicStyle.alignment = TextAnchor.LowerLeft; EditorGUILayout.LabelField("Parsing information", EditorStyles.boldLabel); EditorGUILayout.LabelField("Parsed languages: ", cashLanguages.Length.ToString(), italicStyle); EditorGUILayout.LabelField("Parsed keys: ", Localizator.GetCountParsedKeys().ToString(), italicStyle); }
public void SetChoice(Choice choice) { Choice = choice; if (choice.IsAvalible) { _text.text = Localizator.GetText(choice.TextId); } else { _text.text = Localizator.GetText(choice.BlockedTextId); } EnableButton(choice.IsAvalible); }
private void UpdateTooltip() { if (bgImage) { bgImage.color = bgColor; } if (text) { text.color = textColor; text.text = StringUtilities.IncreaseLinesIfNecessary(localizeText ? Localizator.GetString(tooltipString) : tooltipString, maxLineLength); } }
private void ShowGeneralInformation() { CashLanguages(); var italicStyle = new GUIStyle(GUI.skin.GetStyle("Label")); italicStyle.fontStyle = FontStyle.Italic; italicStyle.alignment = TextAnchor.LowerLeft; EditorGUILayout.LabelField("General information", EditorStyles.boldLabel); EditorGUILayout.LabelField("Current language: ", Localizator.GetCurrentUseLanguage(), italicStyle); EditorGUILayout.LabelField("Available languages: ", cashLanguages.Length.ToString(), italicStyle); DrawSpace(2); }
private void Start() { locoReader = new LocoReader("en-GB"); Localizator.LocalizatorBook.AddReader(locoReader); Localizator.LocalizatorBook.OnLanguageChange += (d) => { FirstText.text = Localizator.Read("Future"); SecondText.text = Localizator.Read("FutureButton"); LanguageText.text = Localizator.LocalizatorBook.CurrentLanguage; }; Localizator.SetLanguage("en-GB"); }
public static GameSave GetEmpty() { GameSave save = new GameSave() { bestLevel = 1, day = 0, bestDayLevel = 1, deathLevel = 1, starCount = 0, metaStarsCount = 0, ticketsCount = 0, deleteBoosterFreeCount = 1, doubleBoosterFreeCount = 1, turnCount = 1, ballCount = 1, campaignLevelsCompleted = 0, additionalCampaignLevelsCompleted = 0, boostersUsed = false, tutorialCompleted = false, completedMetaTutorials = new List <MetaTutorialType>(), achievements = new Achievements(), caveProgress = new MagicalCaveProgress(), openedDragons = new List <DragonSaveView>(), completedQuests = new List <MetaBuilderQuestSave>(), savedEffects = new List <MetaBuilderFxSave>(), savedCollections = new List <MetaBuilderCollectionSave>(), avaliableEffects = new List <int>(), avaliableCollections = new List <int>(), colletedMetaQuestPrizes = new List <MetaBuilderQuestsPrizeProgressSave>(), shownItems = new List <ItemType>(), littleTutorialsPassed = new List <LittleTutorialType>(), AppliedModifiers = new List <Modifier>(), musicIsOn = true, soundIsOn = true, currentEffectPrizeNumber = 0, currentCollectionPrizeNumber = 0, notifications = new List <NotificationInformation>(), firstLaunchTime = DateTime.Now.ToFileTime(), playerBannerAdsCohort = 2, usedDragons = new List <DragonBonusType>() }; save.gameLanguage = Localizator.GetSystemLanguage(); if (MetaGameController.instance != null) { MetaGameController.instance.achievementController.ResetData(); } save.openedDragons.Add(new DragonSaveView(DragonType.DragonOne)); return(save); }
private async void ChatTextBoxGrid_OnDragEnter(object sender, DragEventArgs e) { if (e.DataView.Contains(StandardDataFormats.Bitmap)) { e.AcceptedOperation = DataPackageOperation.Copy; if (e.DragUIOverride != null) { e.DragUIOverride.Caption = Localizator.String("DragDropAttachImage"); } e.Handled = true; } else if (e.DataView.Contains(StandardDataFormats.StorageItems)) { var deferral = e.GetDeferral(); e.AcceptedOperation = DataPackageOperation.None; var items = await e.DataView.GetStorageItemsAsync(); int filesCount = 0; foreach (var item in items) { try { var file = item as StorageFile; if (file != null) { //if (file.ContentType.StartsWith("image/")) // filesCount++; //else filesCount++; } } catch { } } if (filesCount > 0) { e.AcceptedOperation = DataPackageOperation.Copy; if (e.DragUIOverride != null) { e.DragUIOverride.Caption = filesCount == 1 ? Localizator.String("DragDropAttachFile") : Localizator.String("DragDropAttachFiles"); } } e.Handled = true; deferral.Complete(); } }
private async void SaveButton_OnClick(object sender, RoutedEventArgs e) { //TODO string currentPhoto = null; if (_photos.IsNullOrEmpty() || _photos.Count == 1) { currentPhoto = _currentPhoto; } else { currentPhoto = _photos[FlipView.SelectedIndex]; //(string)FlipView.SelectedItem; } var picker = new FileSavePicker(); picker.FileTypeChoices.Add("Image", new List <string>() { Path.GetExtension(currentPhoto) }); picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; var file = await picker.PickSaveFileAsync(); if (file != null) { try { var httpClient = new HttpClient(); var imageStream = await httpClient.GetInputStreamAsync(new Uri(currentPhoto)); var fileStream = await file.OpenStreamForWriteAsync(); await imageStream.AsStreamForRead().CopyToAsync(fileStream); await fileStream.FlushAsync(); fileStream.Dispose(); imageStream.Dispose(); await new MessageDialog(Localizator.String("Errors/SaveImageDialogCommonSuccess"), Localizator.String("Errors/SaveImageDialogTitleDone")).ShowAsync(); } catch (Exception ex) { Logger.Error(ex, "Unable to save image"); await new MessageDialog(Localizator.String("Errors/SaveImageDialogCommonError"), Localizator.String("Errors/SaveImageDialogTitleError")).ShowAsync(); } } }
private void CashLanguages() { if (cashLanguages != null) { return; } var availableLanguages = Localizator.GetAvailableLanguages(); cashLanguages = new string[availableLanguages.Length]; for (int i = 0; i < availableLanguages.Length; i++) { cashLanguages[i] = availableLanguages[i].ToString(); } }
public object Convert(object value, Type targetType, object parameter, string culture) { var date = (DateTime)value; var hours = (DateTime.Now.ToUniversalTime() - date).TotalHours; if (date.Date == DateTime.Today) { return(date.ToString("t")); } if (DateTime.Today - date.Date == TimeSpan.FromDays(1)) { return(Localizator.String("Yesterday").ToLower()); } return(date.ToString(Localizator.String("MessageTimeFormat"))); }
public MessageWallPostControl(VkWallPostAttachment wallPost) { WallPost = wallPost; this.InitializeComponent(); if (string.IsNullOrEmpty(wallPost.Text)) { TitleTextBlock.Text = Localizator.String("ChatMessageWallPostTitle"); DateTextBlock.Text = wallPost.Date.ToString(Localizator.String("MessageWallPostTimeFormat")); } else { TitleTextBlock.Text = WallPost.Text; DateTextBlock.Text = Localizator.String("ChatMessageWallPostTitle") + ", " + wallPost.Date.ToString(Localizator.String("MessageWallPostTimeFormat")); } }
private void SettingsFrm_Load(object sender, System.EventArgs e) { var ports = new List <string>() { "AUTO" }; ports.AddRange(HardwareLibrary.GetComPorts); comboBoxPort.Items.AddRange(ports.ToArray()); comboBoxPort.SelectedItem = ports.Where(x => x == newConfig.Port).FirstOrDefault(); var languages = Localizator.GetAvaliableLanguages(); comboBoxLanguage.Items.AddRange(languages.ToArray()); comboBoxLanguage.SelectedItem = languages.Where(x => x == newConfig.Locale).FirstOrDefault(); checkBoxLog.Checked = newConfig.LogEnable; }
private void ShowParsingButton() { EditorGUILayout.LabelField("File parsing", EditorStyles.boldLabel); if (GUILayout.Button("Parse translations file")) { hasParsingWarnings = Localizator.ParseTranslationFileWithReport(); if (!hasParsingWarnings) { correctlyParsed = true; } } if (hasParsingWarnings) { EditorGUILayout.HelpBox("Localizator has parsing errors. See console for details.", MessageType.Error); } if (correctlyParsed) { EditorGUILayout.HelpBox("Parsing successful.", MessageType.Info); } }
private void FilterKeys() { if (statusToDisplay == LocalizationStatus.All) { keysWithCorrectLocalizationStatus = keys.ToList(); } else { keysWithCorrectLocalizationStatus = new List <string>(); foreach (var key in keys) { var isLocalized = !Localizator.GetLocalizationStatusOfKey(key).Contains(false); if (statusToDisplay == LocalizationStatus.Localized && isLocalized || statusToDisplay == LocalizationStatus.NotLocalized && !isLocalized) { keysWithCorrectLocalizationStatus.Add(key); } } } Search("", ignoreRepetition: true); }
private void VisualizeChoice(Dialog_Give_Choice context) { _replica.text = Localizator.GetText(context.ChoiceTextId); var choicesDelta = context.Choices.Length - _choices.Count; for (int i = 0; i < choicesDelta; i++) { var newChoice = Instantiate(_choicePrefab, _choicesConteiner); _choices.Add(newChoice); newChoice.ChoiceMaded.Subscribe(x => { _switcher.OnChoiceMade(x.Choice); HideChoices(); }, _observers); } for (int i = 0; i < context.Choices.Length; i++) { _choices[i].SetChoice(context.Choices[i]); _choices[i].Show(); } }
public string GetActionText() { if (string.IsNullOrEmpty(MessageContent.Action)) { return(null); } switch (MessageContent.Action) { case "chat_create": return(string.Format(Localizator.String("ChatServiceMessageChatCreated"), Sender?.Name, MessageContent.ActionText)); case "chat_photo_update": return(string.Format(Localizator.String("ChatServiceMessagePhotoUpdated"), Sender?.Name)); case "chat_photo_remove": return(string.Format(Localizator.String("ChatServiceMessagePhotoRemoved"), Sender?.Name)); case "chat_kick_user": return(string.Format(Localizator.String("ChatServiceMessageKickUser"), Sender?.Name)); } return(null); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { var key = Localizator.ConvertRawToKey(property.stringValue); var keyExists = DoesKeyExists(key); // Rects var keyRect = new Rect(position.x, position.y, position.width, 30f); var helpBoxRect = new Rect(keyRect.x, keyRect.y + (keyExists ? 0f : 40f), position.width, 35f); var editKeyRect = new Rect(keyRect.x, helpBoxRect.y + 40f, position.width, 35f); // Drawing Property EditorGUI.PropertyField(keyRect, property, label); property.stringValue = Localizator.ConvertRawToKey(property.stringValue); if (!keyExists) { EditorGUI.HelpBox(helpBoxRect, "The key does not exist in the current context", MessageType.Warning); } if (GUI.Button(editKeyRect, Localizator.DoesContainKey(key) ? $"Edit the '{key}' key" : $"Create a key named '{key}'")) { OpenKeyOnEditor(key); } }