Localization

From Victoria 3 Wiki
Jump to navigation Jump to search

Localization .yml files must be encoded in UTF-8-BOM. Otherwise the game will simply ignore the file. Respect the file suffixes of the kind of file you're replicating. The game not only guides itself on basis of folder structure, but also on files suffixes. For example: "MODNAME_USAGE_decisions_l_english.yml".

The localization files are processed in reverse alphabetical order (from Z to A), adding a or 01 at the beginning of your localization file will make sure it applied last. If you replacing vanilla localization a better practice is to use folder replace as in /english/replace/overwriting_l_english.yml

Version 1.1 brought some major localization file changes. As consequence most mods of version 1.0 that make use of localization files, will corrupt many localization entries, resulting in missing texts.

Languages[edit | edit source]

Each supported language has an internal name which used as the name of the subfolder for the language. Internal name also used for the names of YAML files with l_ (i.e. a lowercase L) in front of it. And as language identifier in the first line of the YAML file as well.

Language internal name
English english
Brazilian Portuguese braz_por
French french
German german
Polish polish
Russian russian
Spanish spanish
Japanese japanese
Simple Chinese simp_chinese
Korean korean
Turkish turkish

Custom Localization[edit | edit source]

Unlike other pdx game, custom localization can only be called by GetCustom('custom_localization_name') in local or [Localize('custom_localization_name')] in global. GetCustom is a series of function of the types.

How to define custom localization name[edit | edit source]

A custom localization name can be defined in common/customizable_localization, It should defined a type to be the ROOT scope and changed by multiple trigger contexts.

film_industry_name = {
	type = country
	random_valid = no

	text = {
		trigger = { # By the trigger context, this text will applied if the trigger is true
			exists = c:USA
			this = c:USA
			owns_entire_state_region = STATE_CALIFORNIA
		}

		localization_key = custom_loc_hollywood
	}

	text = {
		localization_key = custom_loc_film_industry_name_default
	}

}

war_reparations_name_custom_name = {
	type = diplomatic_play

	text = {
		trigger = {
			has_variable = more_war_reparations # diplomatic_play can set and read variable
		}
		localization_key = war_goal_more_war_reparations_name # key in /localization
	}
	text = {
		localization_key = war_goal_war_reparations_name_default
	}
}
war_reparations_custom_name = {
	type = diplomatic_play

	text = {
		trigger = {
			has_variable = more_war_reparations # diplomatic_play can set and read variable
		}
		localization_key = war_goal_war_more_reparations # key in /localization
	}
	text = {
		localization_key = war_goal_war_reparations_default
	}
}


And edit in /localization/<language>, in this example, it used in /localization/l_english

l_english:
 war_goal_war_reparations_type_name:0 "[WarGoal.GetDiplomaticPlay.GetCustom('war_reparations_name_custom_name')]"
 war_goal_war_reparations_name_default:0 "War Reparations"
 war_goal_more_war_reparations_name:0 "More War Reparations"
 war_goal_war_reparations:2 "[WAR_GOAL.GetTarget.GetAdjectiveNoFormatting][WarGoal.GetDiplomaticPlay.GetCustom('war_reparations_custom_name')]"
 war_goal_more_war_reparations:2 " More War Reparations"
 # war_goal_war_reparations_wrong_default:2 "[WAR_GOAL.GetTarget.GetAdjectiveNoFormatting] [concept_war_reparations]"
 # However, Don't try to swith again the scope to war_goal, the scope of war_goal_war_reparations_wrong_default is DiplomaticPlay, it cannot call WAR_GOAL.GetTarget.GetAdjectiveNoFormatting
 war_goal_war_reparations_default:2 " [concept_war_reparations]"


Supported Type of GetCustom[edit | edit source]

'Arg0' Should be a custom localization name defined in common/customizable_localization

  • Battle.GetCustom( Arg0 )
  • Building.GetCustom( Arg0 )
  • BuildingType.GetCustom( Arg0 )
  • CanalType.GetCustom( Arg0 )
  • Character.GetCustom( Arg0 )
  • CivilWar.GetCustom( Arg0 )
  • CombatUnit.GetCustom( Arg0 )
  • CommanderOrder.GetCustom( Arg0 )
  • CommanderOrderType.GetCustom( Arg0 )
  • Country.GetCustom( Arg0 )
  • CountryCreation.GetCustom( Arg0 )
  • CountryDefinition.GetCustom( Arg0 )
  • CountryFormation.GetCustom( Arg0 )
  • Culture.GetCustom( Arg0 )
  • Decree.GetCustom( Arg0 )
  • DiplomaticAction.GetCustom( Arg0 )
  • DiplomaticPact.GetCustom( Arg0 )
  • DiplomaticPlay.GetCustom( Arg0 )
  • DiplomaticRelations.GetCustom( Arg0 )
  • Front.GetCustom( Arg0 )
  • Hq.GetCustom( Arg0 )
  • Ideology.GetCustom( Arg0 )
  • Institution.GetCustom( Arg0 )
  • InstitutionType.GetCustom( Arg0 )
  • Interest.GetCustom( Arg0 )
  • InterestGroup.GetCustom( Arg0 )
  • InterestGroupTrait.GetCustom( Arg0 )
  • JournalEntry.GetCustom( Arg0 )
  • Law.GetCustom( Arg0 )
  • LawType.GetCustom( Arg0 )
  • Market.GetCustom( Arg0 )
  • MarketGoods.GetCustom( Arg0 )
  • Objective.GetCustom( Arg0 )
  • Party.GetCustom( Arg0 )
  • PoliticalMovement.GetCustom( Arg0 )
  • Pop.GetCustom( Arg0 )
  • PopType.GetCustom( Arg0 )
  • Province.GetCustom( Arg0 )
  • Religion.GetCustom( Arg0 )
  • ShippingLane.GetCustom( Arg0 )
  • State.GetCustom( Arg0 )
  • StateRegion.GetCustom( Arg0 )
  • StateTrait.GetCustom( Arg0 )
  • StrategicRegion.GetCustom( Arg0 )
  • Technology.GetCustom( Arg0 )
  • Theater.GetCustom( Arg0 )
  • TradeRoute.GetCustom( Arg0 )
  • War.GetCustom( Arg0 )