2014-12-07 19:09:38 -05:00
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2014-11-18 03:20:09 -05:00
# include "TranslationEditorPrivatePCH.h"
# include "TranslationPickerEditWindow.h"
# include "Editor/Documentation/Public/SDocumentationToolTip.h"
# include "TranslationUnit.h"
2015-07-01 17:12:23 -04:00
# include "ILocalizationServiceModule.h"
2014-11-18 03:20:09 -05:00
# define LOCTEXT_NAMESPACE "TranslationPicker"
2015-07-01 17:12:23 -04:00
TSharedPtr < FTranslationPickerSettingsManager > FTranslationPickerSettingsManager : : TranslationPickerSettingsManagerInstance ;
2015-04-20 21:16:03 -04:00
// Default dimensions of the Translation Picker edit window (floating window also uses these sizes, so it matches roughly)
const int32 STranslationPickerEditWindow : : DefaultEditWindowWidth = 500 ;
const int32 STranslationPickerEditWindow : : DefaultEditWindowHeight = 500 ;
2015-07-01 17:12:23 -04:00
UTranslationPickerSettings : : UTranslationPickerSettings ( const FObjectInitializer & ObjectInitializer )
: Super ( ObjectInitializer )
{
}
2014-11-18 03:20:09 -05:00
void STranslationPickerEditWindow : : Construct ( const FArguments & InArgs )
{
ParentWindow = InArgs . _ParentWindow ;
PickedTexts = InArgs . _PickedTexts ;
WindowContents = SNew ( SBox ) ;
2015-04-20 21:16:03 -04:00
TSharedRef < SVerticalBox > TextsBox = SNew ( SVerticalBox ) ;
2015-07-01 17:12:23 -04:00
UTranslationPickerSettings * TranslationPickerSettings = FTranslationPickerSettingsManager : : Get ( ) - > GetSettings ( ) ;
bool bShowLocServiceCheckbox = ILocalizationServiceModule : : Get ( ) . GetProvider ( ) . IsEnabled ( ) ;
if ( ! FParse : : Param ( FCommandLine : : Get ( ) , TEXT ( " AllowTranslationPickerSubmissionsToOneSky " ) ) )
{
bShowLocServiceCheckbox = false ;
TranslationPickerSettings - > bSubmitTranslationPickerChangesToLocalizationService = false ;
}
2015-02-20 04:41:22 -05:00
2014-11-18 03:20:09 -05:00
// Add a new Translation Picker Edit Widget for each picked text
for ( FText PickedText : PickedTexts )
{
TSharedPtr < SEditableTextBox > TextBox ;
int32 DefaultPadding = 0.0f ;
2015-02-20 04:41:22 -05:00
TSharedRef < STranslationPickerEditWidget > NewEditWidget =
SNew ( STranslationPickerEditWidget )
. PickedText ( PickedText )
. bAllowEditing ( true ) ;
EditWidgets . Add ( NewEditWidget ) ;
2014-11-18 03:20:09 -05:00
TextsBox - > AddSlot ( )
2015-04-03 05:06:51 -04:00
. AutoHeight ( )
2014-11-18 03:20:09 -05:00
. Padding ( FMargin ( 5 ) )
[
SNew ( SBorder )
[
2015-02-20 04:41:22 -05:00
NewEditWidget
2014-11-18 03:20:09 -05:00
]
] ;
}
TSharedPtr < SEditableTextBox > TextBox ;
int32 DefaultPadding = 0.0f ;
// Layout the Translation Picker Edit Widgets and some save/close buttons below them
WindowContents - > SetContent (
SNew ( SBorder )
. BorderImage ( FEditorStyle : : GetBrush ( " ToolPanel.GroupBorder " ) )
[
2015-04-20 21:16:03 -04:00
2014-11-18 03:20:09 -05:00
SNew ( SVerticalBox )
+ SVerticalBox : : Slot ( )
2015-04-03 05:06:51 -04:00
. AutoHeight ( )
2015-04-20 21:16:03 -04:00
. HAlign ( HAlign_Center )
. Padding ( DefaultPadding )
2014-11-18 03:20:09 -05:00
[
2015-04-20 21:16:03 -04:00
// Display name of the current language
SNew ( STextBlock )
. Text ( FText : : FromString ( FInternationalization : : Get ( ) . GetCurrentCulture ( ) - > GetDisplayName ( ) ) )
. Justification ( ETextJustify : : Center )
]
+ SVerticalBox : : Slot ( )
[
SNew ( SScrollBox )
+ SScrollBox : : Slot ( )
. Padding ( 0.0f )
2014-11-18 03:20:09 -05:00
[
SNew ( SVerticalBox )
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
2015-04-20 21:16:03 -04:00
. Padding ( FMargin ( 8 , 5 , 8 , 5 ) )
2014-11-18 03:20:09 -05:00
[
TextsBox
]
2015-04-20 21:16:03 -04:00
]
]
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
2015-07-01 17:12:23 -04:00
. HAlign ( HAlign_Fill )
2015-04-20 21:16:03 -04:00
. Padding ( DefaultPadding )
[
2015-07-01 17:12:23 -04:00
SNew ( SVerticalBox )
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. HAlign ( HAlign_Left )
. Padding ( DefaultPadding )
2015-04-20 21:16:03 -04:00
[
2015-07-01 17:12:23 -04:00
SNew ( SHorizontalBox )
. Visibility ( bShowLocServiceCheckbox ? EVisibility : : Visible : EVisibility : : Collapsed )
+ SHorizontalBox : : Slot ( )
. Padding ( FMargin ( 3 , 3 , 3 , 3 ) )
. VAlign ( VAlign_Center )
. AutoWidth ( )
2014-11-18 03:20:09 -05:00
[
2015-07-01 17:12:23 -04:00
SNew ( SCheckBox )
. HAlign ( HAlign_Center )
. IsChecked ( TranslationPickerSettings - > bSubmitTranslationPickerChangesToLocalizationService ? ECheckBoxState : : Checked : ECheckBoxState : : Unchecked )
. ToolTipText ( LOCTEXT ( " SubmitTranslationPickerChangesToLocalizationServiceToolTip " , " Submit changes to localization service " ) )
. OnCheckStateChanged_Lambda ( [ & ] ( ECheckBoxState CheckedState )
{
UTranslationPickerSettings * TranslationPickerSettingsLocal = FTranslationPickerSettingsManager : : Get ( ) - > GetSettings ( ) ;
TranslationPickerSettingsLocal - > bSubmitTranslationPickerChangesToLocalizationService = CheckedState = = ECheckBoxState : : Checked ;
TranslationPickerSettingsLocal - > SaveConfig ( ) ;
}
)
]
+ SHorizontalBox : : Slot ( )
. Padding ( FMargin ( 0 , 0 , 3 , 0 ) )
. VAlign ( VAlign_Center )
. AutoWidth ( )
[
SNew ( STextBlock )
. Text ( LOCTEXT ( " SubmitTranslationPickerChangesToLocalizationService " , " Save to Localization Service " ) )
. ToolTipText ( LOCTEXT ( " SubmitTranslationPickerChangesToLocalizationServiceToolTip " , " Submit changes to localization service " ) )
2014-11-18 03:20:09 -05:00
]
]
2015-07-01 17:12:23 -04:00
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. HAlign ( HAlign_Right )
. Padding ( DefaultPadding )
2015-04-20 21:16:03 -04:00
[
2015-07-01 17:12:23 -04:00
SNew ( SUniformGridPanel )
. SlotPadding ( FEditorStyle : : GetMargin ( " StandardDialog.SlotPadding " ) )
. MinDesiredSlotWidth ( FEditorStyle : : GetFloat ( " StandardDialog.MinDesiredSlotWidth " ) )
. MinDesiredSlotHeight ( FEditorStyle : : GetFloat ( " StandardDialog.MinDesiredSlotHeight " ) )
+ SUniformGridPanel : : Slot ( 0 , 0 )
[
SNew ( SButton )
. HAlign ( HAlign_Center )
. ContentPadding ( FEditorStyle : : GetMargin ( " StandardDialog.ContentPadding " ) )
. OnClicked ( this , & STranslationPickerEditWindow : : SaveAllAndClose )
[
SNew ( SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. Padding ( FMargin ( 0 , 0 , 3 , 0 ) )
. VAlign ( VAlign_Center )
. AutoWidth ( )
[
SNew ( STextBlock ) . Text ( LOCTEXT ( " SaveAllAndClose " , " Save all and close " ) )
]
]
]
+ SUniformGridPanel : : Slot ( 1 , 0 )
[
SNew ( SButton )
. HAlign ( HAlign_Center )
. ContentPadding ( FEditorStyle : : GetMargin ( " StandardDialog.ContentPadding " ) )
. OnClicked ( this , & STranslationPickerEditWindow : : Close )
. VAlign ( VAlign_Center )
. Text ( LOCTEXT ( " CancelButton " , " Cancel " ) )
]
2015-04-20 21:16:03 -04:00
]
2014-11-18 03:20:09 -05:00
]
]
) ;
ChildSlot
[
WindowContents . ToSharedRef ( )
] ;
}
FReply STranslationPickerEditWindow : : OnKeyDown ( const FGeometry & MyGeometry , const FKeyEvent & InKeyEvent )
{
if ( InKeyEvent . GetKey ( ) = = EKeys : : Escape )
{
Close ( ) ;
return FReply : : Handled ( ) ;
}
return FReply : : Unhandled ( ) ;
}
FReply STranslationPickerEditWindow : : Close ( )
{
if ( ParentWindow . IsValid ( ) )
{
FSlateApplication : : Get ( ) . RequestDestroyWindow ( ParentWindow . Pin ( ) . ToSharedRef ( ) ) ;
ParentWindow . Reset ( ) ;
}
return FReply : : Handled ( ) ;
}
2015-02-20 04:41:22 -05:00
FReply STranslationPickerEditWindow : : SaveAllAndClose ( )
{
TArray < UTranslationUnit * > TempArray ;
for ( TSharedRef < STranslationPickerEditWidget > EditWidget : EditWidgets )
{
UTranslationUnit * TranslationUnit = EditWidget - > GetTranslationUnitWithAnyChanges ( ) ;
2015-07-13 09:44:27 -04:00
if ( TranslationUnit ! = nullptr & & EditWidget - > CanSave ( ) )
2015-02-20 04:41:22 -05:00
{
TempArray . Add ( TranslationUnit ) ;
}
}
if ( TempArray . Num ( ) > 0 )
{
2015-07-01 17:12:23 -04:00
UTranslationPickerSettings * TranslationPickerSettings = FTranslationPickerSettingsManager : : Get ( ) - > GetSettings ( ) ;
2015-02-20 04:41:22 -05:00
// Save the data via translation data manager
2015-07-01 17:12:23 -04:00
FTranslationDataManager : : SaveSelectedTranslations ( TempArray , ILocalizationServiceModule : : Get ( ) . GetProvider ( ) . IsEnabled ( ) & & TranslationPickerSettings - > bSubmitTranslationPickerChangesToLocalizationService ) ;
2015-02-20 04:41:22 -05:00
}
Close ( ) ;
return FReply : : Handled ( ) ;
}
2014-11-18 03:20:09 -05:00
void STranslationPickerEditWidget : : Construct ( const FArguments & InArgs )
{
PickedText = InArgs . _PickedText ;
2015-02-20 04:41:22 -05:00
bAllowEditing = InArgs . _bAllowEditing ;
2014-11-18 03:20:09 -05:00
int32 DefaultPadding = 0.0f ;
2015-04-03 05:06:51 -04:00
bool bCultureInvariant = PickedText . IsCultureInvariant ( ) ;
bool bShouldGatherForLocalization = FTextInspector : : ShouldGatherForLocalization ( PickedText ) ;
2014-11-18 03:20:09 -05:00
// Get all the data we need and format it properly
2015-04-16 15:39:05 -04:00
TOptional < FString > NamespaceString = FTextInspector : : GetNamespace ( PickedText ) ;
TOptional < FString > KeyString = FTextInspector : : GetKey ( PickedText ) ;
2014-11-18 03:20:09 -05:00
const FString * SourceString = FTextInspector : : GetSourceString ( PickedText ) ;
const FString & TranslationString = FTextInspector : : GetDisplayString ( PickedText ) ;
FString LocresFullPath ;
FString ManifestAndArchiveNameString ;
if ( NamespaceString & & KeyString )
{
2015-04-16 15:39:05 -04:00
FString LocResId ;
if ( FTextLocalizationManager : : Get ( ) . GetLocResID ( NamespaceString . GetValue ( ) , KeyString . GetValue ( ) , LocResId ) )
2014-11-18 03:20:09 -05:00
{
2015-04-16 15:39:05 -04:00
LocresFullPath = * LocResId ;
ManifestAndArchiveNameString = FPaths : : GetBaseFilename ( * LocResId ) ;
2014-11-18 03:20:09 -05:00
}
}
2015-07-01 17:12:23 -04:00
FString ArchiveFilePath = FPaths : : GetPath ( LocresFullPath ) ;
FString LocResCultureName = FPaths : : GetBaseFilename ( ArchiveFilePath ) ;
FInternationalization & I18N = FInternationalization : : Get ( ) ;
FString CurrentCultureName = I18N . GetCurrentCulture ( ) - > GetName ( ) ;
// Make sure locres path matches the current culture (can change if using the culture=__ console command)
2015-07-13 09:44:27 -04:00
if ( ! LocResCultureName . IsEmpty ( ) & & CurrentCultureName ! = LocResCultureName )
2015-07-01 17:12:23 -04:00
{
FString BasePath = FPaths : : GetPath ( ArchiveFilePath ) ;
LocresFullPath = BasePath / CurrentCultureName / ManifestAndArchiveNameString + " .locres " ;
}
2015-04-16 15:39:05 -04:00
FText Namespace = FText : : FromString ( NamespaceString . Get ( TEXT ( " " ) ) ) ;
FText Key = FText : : FromString ( KeyString . Get ( TEXT ( " " ) ) ) ;
2014-11-18 03:20:09 -05:00
FText Source = SourceString ! = nullptr ? FText : : FromString ( * SourceString ) : FText : : GetEmpty ( ) ;
FText ManifestAndArchiveName = FText : : FromString ( ManifestAndArchiveNameString ) ;
FText Translation = FText : : FromString ( TranslationString ) ;
2015-04-20 21:16:03 -04:00
FText SourceLabel = LOCTEXT ( " SourceLabel " , " Source: " ) ;
FText NamespaceLabel = LOCTEXT ( " NamespaceLabel " , " Namespace: " ) ;
FText KeyLabel = LOCTEXT ( " KeyLabel " , " Key: " ) ;
FText ManifestAndArchiveNameLabel = LOCTEXT ( " LocresFileLabel " , " Target : " ) ;
2014-11-18 03:20:09 -05:00
// Save the necessary data in UTranslationUnit for later. This is what we pass to TranslationDataManager to save our edits
TranslationUnit = NewObject < UTranslationUnit > ( ) ;
2015-04-16 15:39:05 -04:00
TranslationUnit - > Namespace = NamespaceString . Get ( TEXT ( " " ) ) ;
2014-11-18 03:20:09 -05:00
TranslationUnit - > Source = SourceString ! = nullptr ? * SourceString : " " ;
TranslationUnit - > Translation = TranslationString ;
TranslationUnit - > LocresPath = LocresFullPath ;
2015-04-20 21:16:03 -04:00
2015-02-19 20:53:05 -05:00
// Can only save if we have all the required information
2015-07-13 09:44:27 -04:00
bHasRequiredLocalizationInfoForSaving = NamespaceString . IsSet ( ) & & SourceString ! = nullptr & & LocresFullPath . Len ( ) > 0 ;
2015-04-03 05:06:51 -04:00
2015-04-20 21:16:03 -04:00
TSharedPtr < SGridPanel > GridPanel ;
TSharedRef < SGridPanel > LocalizationInfoAndSaveButtonSlot = SNew ( SGridPanel ) . FillColumn ( 2 , 1 ) ;
// Layout all our data
ChildSlot
[
SNew ( SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. FillWidth ( 1 )
. Padding ( FMargin ( 5 ) )
[
SNew ( SVerticalBox )
+ SVerticalBox : : Slot ( )
[
SAssignNew ( GridPanel , SGridPanel )
. FillColumn ( 1 , 1 )
+ SGridPanel : : Slot ( 0 , 0 )
. Padding ( FMargin ( 5 ) )
. HAlign ( HAlign_Right )
[
SNew ( STextBlock )
. TextStyle ( FEditorStyle : : Get ( ) , " RichTextBlock.Bold " )
. Text ( SourceLabel )
]
+ SGridPanel : : Slot ( 0 , 1 )
. Padding ( FMargin ( 5 ) )
. HAlign ( HAlign_Right )
[
SNew ( SVerticalBox )
2015-07-13 09:44:27 -04:00
// Hide translation if we don't have necessary information to modify, and is same as source
. Visibility ( ! bHasRequiredLocalizationInfoForSaving & & SourceString - > Equals ( TranslationString ) ? EVisibility : : Collapsed : EVisibility : : Visible )
2015-04-20 21:16:03 -04:00
+ SVerticalBox : : Slot ( )
[
SNew ( STextBlock )
. TextStyle ( FEditorStyle : : Get ( ) , " RichTextBlock.Bold " )
. Text ( LOCTEXT ( " TranslationLabel " , " Translation: " ) )
]
]
+ SGridPanel : : Slot ( 1 , 0 )
. Padding ( FMargin ( 5 ) )
. ColumnSpan ( 2 )
[
SNew ( STextBlock )
. Text ( Source )
]
+ SGridPanel : : Slot ( 1 , 1 )
. ColumnSpan ( 2 )
. Padding ( FMargin ( 5 ) )
[
SNew ( SVerticalBox )
2015-07-13 09:44:27 -04:00
// Hide translation if we don't have necessary information to modify, and is same as source
. Visibility ( ! bHasRequiredLocalizationInfoForSaving & & SourceString - > Equals ( TranslationString ) ? EVisibility : : Collapsed : EVisibility : : Visible )
2015-04-20 21:16:03 -04:00
+ SVerticalBox : : Slot ( )
[
SAssignNew ( TextBox , SMultiLineEditableTextBox )
2015-07-13 09:44:27 -04:00
. IsEnabled ( bAllowEditing & & bHasRequiredLocalizationInfoForSaving )
2015-04-20 21:16:03 -04:00
. Text ( Translation )
. HintText ( LOCTEXT ( " TranslationEditTextBox_HintText " , " Enter/edit translation here. " ) )
]
]
]
+ SVerticalBox : : Slot ( )
. AutoHeight ( )
. Padding ( FMargin ( 5 ) )
[
LocalizationInfoAndSaveButtonSlot
]
]
] ;
2015-04-03 05:06:51 -04:00
if ( bCultureInvariant )
{
2015-04-20 21:16:03 -04:00
LocalizationInfoAndSaveButtonSlot - > AddSlot ( 0 , 0 )
2015-04-03 05:06:51 -04:00
. Padding ( FMargin ( 5 ) )
2015-04-20 21:16:03 -04:00
. ColumnSpan ( 2 )
2015-04-03 05:06:51 -04:00
[
SNew ( STextBlock )
2015-04-20 21:16:03 -04:00
. Text ( LOCTEXT ( " CultureInvariantLabel " , " This text is culture-invariant " ) )
2015-04-03 05:06:51 -04:00
. Justification ( ETextJustify : : Center )
] ;
}
else if ( ! bShouldGatherForLocalization )
{
2015-04-20 21:16:03 -04:00
LocalizationInfoAndSaveButtonSlot - > AddSlot ( 0 , 0 )
2015-04-03 05:06:51 -04:00
. Padding ( FMargin ( 5 ) )
2015-04-20 21:16:03 -04:00
. ColumnSpan ( 2 )
2015-04-03 05:06:51 -04:00
[
SNew ( STextBlock )
. Text ( LOCTEXT ( " NotGatheredForLocalizationLabel " , " This text is not gathered for localization " ) )
. Justification ( ETextJustify : : Center )
] ;
}
2015-07-13 09:44:27 -04:00
else if ( ! bHasRequiredLocalizationInfoForSaving )
2015-04-03 05:06:51 -04:00
{
2015-04-20 21:16:03 -04:00
LocalizationInfoAndSaveButtonSlot - > AddSlot ( 0 , 0 )
2015-04-03 05:06:51 -04:00
. Padding ( FMargin ( 5 ) )
2015-04-20 21:16:03 -04:00
. ColumnSpan ( 2 )
2015-04-03 05:06:51 -04:00
[
SNew ( STextBlock )
2015-07-13 09:44:27 -04:00
. Text ( LOCTEXT ( " RequiredLocalizationInfoNotFound " , " This text is not ready to be localized. " ) )
2015-04-03 05:06:51 -04:00
. Justification ( ETextJustify : : Center )
] ;
}
else
{
2015-04-20 21:16:03 -04:00
LocalizationInfoAndSaveButtonSlot - > AddSlot ( 0 , 0 )
. Padding ( FMargin ( 2.5 ) )
. HAlign ( HAlign_Right )
2015-04-03 05:06:51 -04:00
[
2015-04-20 21:16:03 -04:00
SNew ( STextBlock )
. TextStyle ( FEditorStyle : : Get ( ) , " RichTextBlock.Bold " )
. Text ( NamespaceLabel )
2015-04-03 05:06:51 -04:00
] ;
2015-04-20 21:16:03 -04:00
LocalizationInfoAndSaveButtonSlot - > AddSlot ( 1 , 0 )
. Padding ( FMargin ( 2.5 ) )
[
SNew ( STextBlock )
. Text ( Namespace )
] ;
LocalizationInfoAndSaveButtonSlot - > AddSlot ( 0 , 1 )
. Padding ( FMargin ( 2.5 ) )
. HAlign ( HAlign_Right )
[
SNew ( STextBlock )
. TextStyle ( FEditorStyle : : Get ( ) , " RichTextBlock.Bold " )
. Text ( KeyLabel )
] ;
LocalizationInfoAndSaveButtonSlot - > AddSlot ( 1 , 1 )
. Padding ( FMargin ( 2.5 ) )
[
SNew ( STextBlock )
. Text ( Key )
] ;
LocalizationInfoAndSaveButtonSlot - > AddSlot ( 0 , 2 )
. Padding ( FMargin ( 2.5 ) )
. HAlign ( HAlign_Right )
[
SNew ( STextBlock )
. TextStyle ( FEditorStyle : : Get ( ) , " RichTextBlock.Bold " )
. Text ( ManifestAndArchiveNameLabel )
] ;
LocalizationInfoAndSaveButtonSlot - > AddSlot ( 1 , 2 )
. Padding ( FMargin ( 2.5 ) )
[
SNew ( STextBlock )
. Text ( ManifestAndArchiveName )
] ;
LocalizationInfoAndSaveButtonSlot - > AddSlot ( 2 , 2 )
. Padding ( FMargin ( 2.5 ) )
2015-04-03 05:06:51 -04:00
[
SNew ( SButton )
. HAlign ( HAlign_Center )
. ContentPadding ( FEditorStyle : : GetMargin ( " StandardDialog.ContentPadding " ) )
. OnClicked ( this , & STranslationPickerEditWidget : : SaveAndPreview )
2015-07-13 09:44:27 -04:00
. IsEnabled ( bHasRequiredLocalizationInfoForSaving )
2015-04-03 05:06:51 -04:00
. Visibility ( bAllowEditing ? EVisibility : : Visible : EVisibility : : Collapsed )
[
SNew ( SHorizontalBox )
+ SHorizontalBox : : Slot ( )
. Padding ( FMargin ( 0 , 0 , 3 , 0 ) )
. VAlign ( VAlign_Center )
. AutoWidth ( )
[
SNew ( STextBlock )
2015-07-13 09:44:27 -04:00
. Text ( bHasRequiredLocalizationInfoForSaving ? LOCTEXT ( " SaveAndPreviewButtonText " , " Save and preview " ) : LOCTEXT ( " SaveAndPreviewButtonDisabledText " , " Cannot Save " ) )
2015-04-03 05:06:51 -04:00
]
]
] ;
}
2014-11-18 03:20:09 -05:00
}
FReply STranslationPickerEditWidget : : SaveAndPreview ( )
{
// Update translation string from entered text
TranslationUnit - > Translation = TextBox - > GetText ( ) . ToString ( ) ;
2015-07-01 17:12:23 -04:00
UTranslationPickerSettings * TranslationPickerSettings = FTranslationPickerSettingsManager : : Get ( ) - > GetSettings ( ) ;
2014-11-18 03:20:09 -05:00
// Save the data via translation data manager
TArray < UTranslationUnit * > TempArray ;
TempArray . Add ( TranslationUnit ) ;
2015-07-01 17:12:23 -04:00
FTranslationDataManager : : SaveSelectedTranslations ( TempArray , ILocalizationServiceModule : : Get ( ) . GetProvider ( ) . IsEnabled ( ) & & TranslationPickerSettings - > bSubmitTranslationPickerChangesToLocalizationService ) ;
2014-11-18 03:20:09 -05:00
return FReply : : Handled ( ) ;
}
2015-02-20 04:41:22 -05:00
UTranslationUnit * STranslationPickerEditWidget : : GetTranslationUnitWithAnyChanges ( )
{
if ( TranslationUnit )
{
// Update translation string from entered text
TranslationUnit - > Translation = TextBox - > GetText ( ) . ToString ( ) ;
return TranslationUnit ;
}
return nullptr ;
}
2014-11-18 03:20:09 -05:00
# undef LOCTEXT_NAMESPACE