I made a full blueprint project and i have to localize my game with the Localization Dashboard. There is a way (mayabe a node) to change Localization at Runtime without C++? Thanks!
Not currently, although I have added one for 4.17. For now you’ll have to make your own UFUNCTION and expose it to BPs.
For your reference, this is the version I added for 4.17:
// .h
/**
* Set the current culture.
* @note This function is a sledgehammer, and will set both the language and locale, as well as clear out any asset group cultures that may be set.
* @param Culture The culture to set, as an IETF language tag (eg, "zh-Hans-CN").
* @param SaveToConfig If true, save the new setting to the users' "GameUserSettings" config so that it persists after a reload.
* @return True if the culture was set, false otherwise.
*/
UFUNCTION(BlueprintCallable, Category="Utilities|Internationalization", meta=(AdvancedDisplay="1"))
static bool SetCurrentCulture(const FString& Culture, const bool SaveToConfig = false);
// .cpp
bool UKismetInternationalizationLibrary::SetCurrentCulture(const FString& Culture, const bool SaveToConfig)
{
if (FInternationalization::Get().SetCurrentCulture(Culture))
{
if (!GIsEditor && SaveToConfig)
{
GConfig->SetString(TEXT("Internationalization"), TEXT("Culture"), *Culture, GGameUserSettingsIni);
GConfig->EmptySection(TEXT("Internationalization.AssetGroupCultures"), GGameUserSettingsIni);
GConfig->Flush(false, GGameUserSettingsIni);
}
return true;
}
return false;
}
This changes the active culture, and also has an option to persist the new setting to the users’ game config so it’s applied automatically on the next run.
Hi Jamie, i found a console command to change the current culture at runtime ("-culture=it-IT"), having this setted in dashboard.
I execute it with the “execute console command” node, and it works without C++ classes.
Is it a correct way to resolve this issue without C++?
I’ve just checked the code (those are handled by UEngine::Exec) and unfortunately those are wrapped in #if ENABLE_LOC_TESTING which means they won’t work in a shipping build.
There’s no real reason for them to be disabled in a shipping build, so I’m going to change that… although you won’t see that change until 4.17, at which point there will also be a proper BP node built-in.
i understand, thanks!
Great, after a while looking for this finally it seems that there is a BP solution!!
(i’m already with 4.18)
I just check and yes there is a node set culture
so thanks @Jamie Dale
and really thanks to @Rosterbyte to find the solution!!
Ok testing it, I can change the language after compilation, not during the testing. but any case that is already great!!