diff --git a/VoidLink/Localization/Localizable.xcstrings b/VoidLink/Localization/Localizable.xcstrings index 6332ef50..1b2641e1 100644 --- a/VoidLink/Localization/Localizable.xcstrings +++ b/VoidLink/Localization/Localizable.xcstrings @@ -93,6 +93,29 @@ } } }, + " Profile: %@ Widget: %@" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : " 当前布局: %@ 当前组件: %@" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : " 当前布局: %@ 当前组件: %@" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : " 当前布局: %@ 当前组件: %@" + } + } + } + }, " Wake-on-LAN" : { "extractionState" : "manual", "localizations" : { diff --git a/VoidLink/Localization/LocalizationHelper.m b/VoidLink/Localization/LocalizationHelper.m index 4e149306..fe6c3dc4 100644 --- a/VoidLink/Localization/LocalizationHelper.m +++ b/VoidLink/Localization/LocalizationHelper.m @@ -13,8 +13,10 @@ + (NSString *)localizedStringForKey:(NSString *)key, ... { va_list args; va_start(args, key); + NSString *format = NSLocalizedStringFromTable(key, @"Localizable", nil); NSString *result = [[NSString alloc] initWithFormat:format arguments:args]; + va_end(args); return result; } diff --git a/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m b/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m index ead9b3d3..6e301611 100644 --- a/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m +++ b/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m @@ -650,13 +650,19 @@ OnScreenWidgetView* widgetView = (OnScreenWidgetView* )notification.object; - [self->selectedWidgetView.stickBallLayer removeFromSuperlayer]; [self->selectedWidgetView.crossMarkLayer removeFromSuperlayer]; self->widgetViewSelected = true; self->controllerLayerSelected = false; self->selectedWidgetView = widgetView; + [self autoFitLabel:self.currentProfileLabel]; + self.currentProfileLabel.textAlignment = NSTextAlignmentLeft; + [self.currentProfileLabel setText: + [LocalizationHelper localizedStringForKey:@" Profile: %@ Widget: %@", + [profilesManager getSelectedProfile].name, + selectedWidgetView.buttonLabel]]; + self.undoButton.alpha = selectedWidgetView.layoutChanges.count>1 ? 1.0 : 0.3; [self.layoutOSC updateGuidelinesForOnScreenWidget:self->selectedWidgetView]; // shows guideline immediately when widget is tapped @@ -739,6 +745,14 @@ self->selectedControllerLayer = controllerLayer; self->controllerLoadedBounds = controllerLayer.bounds; + [self autoFitLabel:self.currentProfileLabel]; + self.currentProfileLabel.textAlignment = NSTextAlignmentLeft; + [self.currentProfileLabel setText: + [LocalizationHelper localizedStringForKey:@" Profile: %@ Widget: %@", + [profilesManager getSelectedProfile].name, + selectedControllerLayer.name]]; + + // setup slider values CGFloat sizeFactor = [OnScreenControls getControllerLayerSizeFactor:controllerLayer]; // calculated sizeFactor from loaded layer bounds. [self.widgetSizeSlider setValue:sizeFactor]; @@ -906,7 +920,8 @@ [self.currentProfileLabel setText:[LocalizationHelper localizedStringForKey:@"Profile: %@",[profilesManager getSelectedProfile].name]]; self.currentProfileLabel.layer.cornerRadius = [self isIPhone] ? 9 : 12; self.currentProfileLabel.clipsToBounds = YES; - + self.currentProfileLabel.textAlignment = NSTextAlignmentCenter; + self.widgetSizeStack.userInteractionEnabled = YES; for(UIView* view in _widgetPanelStack.subviews){ view.userInteractionEnabled = YES;