bImportNativeAsSource

bImportNativeAsSource

#Overview

name: bImportNativeAsSource

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bImportNativeAsSource is to control how native culture dialogue is imported in the localization process for Unreal Engine projects. Specifically, it determines whether the dialogue for the native culture should be treated as source audio or as localized data.

This setting variable is primarily used in the Localization system of Unreal Engine. It is referenced in the following modules and files:

  1. Localization module (LocalizationConfigurationScript.cpp)
  2. LocalizationTargetTypes.h
  3. LocalizationCommandletExecution module (LocalizationCommandletTasks.cpp)
  4. UnrealEd module (ImportLocalizedDialogueCommandlet.cpp)

The value of this variable is typically set in the localization target settings, specifically in the FLocalizationImportDialogueSettings struct. By default, it is set to false.

This variable interacts with other localization-related variables and settings, such as:

Developers must be aware of the following when using this variable:

  1. When set to true, the native culture dialogue will be imported as source audio.
  2. When set to false, the native culture dialogue will be imported as localized data for the native culture.
  3. It affects the import process and file structure of the localized audio assets.

Best practices when using this variable include:

  1. Carefully consider the project’s localization strategy before changing this setting.
  2. Ensure consistency across all localization targets in the project.
  3. Be aware of how this setting affects the import process and adjust your workflow accordingly.
  4. Document the chosen setting and its implications for the development team.
  5. Test the localization import process thoroughly after changing this setting to ensure it meets the project’s requirements.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/Localization/EngineOverrides_ImportDialogue.ini:27, section: [GatherTextStep0]

Location: <Workspace>/Projects/Lyra/Config/Localization/Game_ImportDialogue.ini:27, section: [GatherTextStep0]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Developer/Localization/Private/LocalizationConfigurationScript.cpp:1047

Scope (from outer to inner):

file
namespace    LocalizationConfigurationScript
function     FLocalizationConfigurationScript GenerateImportDialogueConfigFile

Source code excerpt:

			ConfigSection.Add(TEXT("RawAudioPath"), Target->Settings.ImportDialogueSettings.RawAudioPath.Path);
			ConfigSection.Add(TEXT("ImportedDialogueFolder"), Target->Settings.ImportDialogueSettings.ImportedDialogueFolder);
			ConfigSection.Add(TEXT("bImportNativeAsSource"), Target->Settings.ImportDialogueSettings.bImportNativeAsSource ? TEXT("true") : TEXT("false"));

			Script.AddGatherTextStep(0, MoveTemp(ConfigSection));
		}

		Script.Dirty = true;

#Loc: <Workspace>/Engine/Source/Developer/Localization/Public/LocalizationTargetTypes.h:366

Scope (from outer to inner):

file
function     FLocalizationImportDialogueSettings

Source code excerpt:

	FLocalizationImportDialogueSettings()
		: ImportedDialogueFolder(TEXT("ImportedDialogue"))
		, bImportNativeAsSource(false)
	{
	}

	/** Path to the folder to import the audio from. This folder is expected to contain culture sub-folders, which in turn contain the raw WAV files to import. */
	UPROPERTY(config, EditAnywhere, Category="Dialogue")
	FDirectoryPath RawAudioPath;

#Loc: <Workspace>/Engine/Source/Developer/Localization/Public/LocalizationTargetTypes.h:380

Scope: file

Source code excerpt:

	/** Should the dialogue for the native culture be imported as if it were source audio? If false, the native culture dialogue will be imported as localized data for the native culture. */
	UPROPERTY(config, EditAnywhere, Category="Dialogue")
	bool bImportNativeAsSource;
};

USTRUCT()
struct FCultureStatistics
{
	GENERATED_USTRUCT_BODY()

#Loc: <Workspace>/Engine/Source/Editor/LocalizationCommandletExecution/Private/LocalizationCommandletTasks.cpp:559

Scope (from outer to inner):

file
function     bool LocalizationCommandletTasks::ReportLoadedAudioAssets

Source code excerpt:

		{
			const FString NativeCulture = Target->Settings.SupportedCulturesStatistics.IsValidIndex(Target->Settings.NativeCultureIndex) ? Target->Settings.SupportedCulturesStatistics[Target->Settings.NativeCultureIndex].CultureName : FString();
			const bool bImportNativeAsSource = Target->Settings.ImportDialogueSettings.bImportNativeAsSource && !NativeCulture.IsEmpty();
			if (bImportNativeAsSource)
			{
				DialogueWavePathsToTest.Add(RootAssetPath);
				SoundWavePathsToTest.Add(RootAssetPath / Target->Settings.ImportDialogueSettings.ImportedDialogueFolder);
			}

			for (const FString& Culture : CulturesToTest)
			{
				if (bImportNativeAsSource && Culture == NativeCulture)
				{
					continue;
				}

				DialogueWavePathsToTest.Add(RootAssetPath / TEXT("L10N") / Culture);
				SoundWavePathsToTest.Add(RootAssetPath / TEXT("L10N") / Culture / Target->Settings.ImportDialogueSettings.ImportedDialogueFolder);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/ImportLocalizedDialogueCommandlet.cpp:103

Scope (from outer to inner):

file
function     int32 UImportLocalizedDialogueCommandlet::Main

Source code excerpt:


	// Should we import the native audio as source audio?
	bool bImportNativeAsSource = false;
	if (!GetBoolFromConfig(*SectionName, TEXT("bImportNativeAsSource"), bImportNativeAsSource, ConfigPath))
	{
		bImportNativeAsSource = false;
	}

	// Source path to the raw audio files that we're going to import
	FString RawAudioPath;
	if (!GetPathFromConfig(*SectionName, TEXT("RawAudioPath"), RawAudioPath, ConfigPath))
	{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/ImportLocalizedDialogueCommandlet.cpp:227

Scope (from outer to inner):

file
function     int32 UImportLocalizedDialogueCommandlet::Main

Source code excerpt:


		// If we're importing native as source, then we import using a special culture import info
		if (bImportNativeAsSource && CultureImportInfoMap.Contains(NativeCulture))
		{
			FCultureImportInfo SourceCultureImportInfo = CultureImportInfoMap.FindRef(NativeCulture);
			SourceCultureImportInfo.LocalizedRootContentPath = RootContentDir;
			SourceCultureImportInfo.LocalizedRootPackagePath = RootAssetPath;
			SourceCultureImportInfo.LocalizedImportedDialoguePackagePath = SourceCultureImportInfo.LocalizedRootPackagePath / ImportedDialogueFolder;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Commandlets/ImportLocalizedDialogueCommandlet.cpp:243

Scope (from outer to inner):

file
function     int32 UImportLocalizedDialogueCommandlet::Main

Source code excerpt:


			// Skip the native culture if importing native as source, as we'll have imported it above
			if (bImportNativeAsSource && CultureImportInfo.bIsNativeCulture)
			{
				continue;
			}

			ImportDialogueForCulture(LocTextHelper, DialogueWave, DialogueWaveSubPath, CultureImportInfo, /*bImportAsSource*/false);
		}