Using Custom Localization - Gr770/CK3-Community-Title-Project GitHub Wiki

While flavorization has expanded what you can localize for many characters, the use is still somewhat limited. Sometimes you’ll want to use other triggers that aren’t available through basic flavorization or you’ll want to use more priority space. Fear not, you can use custom localization to extended localization!

I’ll be using CTP’s Irish Kings and Kingdoms localization as the example today, I will also be showing our mod’s most complex custom loc at the end so you can see what you can do with it.

king_male_goidelic_group = {
    type = character
    gender = male
    special = holder
    priority = 142
    tier = kingdom
    culture_groups = { goidelic_group }
    governments = { feudal_government clan_government tribal_government }
    top_liege = no
}
king_female_goidelic_group = {
    type = character
    gender = female
    special = holder
    priority = 142
    tier = kingdom
    culture_groups = { goidelic_group }
    governments = { feudal_government clan_government tribal_government }
    top_liege = no
}
kingdom_goidelic_group = {
    type = title
    tier = kingdom
    priority = 142
    culture_groups = { goidelic_group }
    governments = { feudal_government clan_government tribal_government }
    top_liege = no
}

First we are going to set up a custom loc file under MOD\common\customizable_localization. Ours is 00_ctp_kingdom.txt. Make sure it’s UTF-8 BOM!

Now we start each custom loc we want to call with a namespace. Let’s keep it simple shall we.

KingMaleGoidelic = {
KingFemaleGoidelic = {
KingdomGoidelic = {

For the type, every custom loc used in flavorization is character type. All flavor titles are linked to the holder, including the landed title.

KingdomGoidelic = {
    type = character

Now we want to set up the conditions for Sultans and Sultanates. With CTP, we decided the tenet ‘Struggle and Submission’ is the best fit for it.

Important requirements are text = { for each new localization, trigger = { for the set of conditions and localization_key = { which will be your… new localization key.

KingdomGoidelic = {
    type = character
    text = {
        trigger = {
            is_independent_ruler = yes
            root.faith = {
                has_doctrine = tenet_struggle_submission
            }
        }
        localization_key = sultanate_goidelic
    }
}

Now this is fine for landed titles, but remember to include a spousal condition for your actual characters. exist = { is not needed for spouses, but you'll create errors in the log.

KingMaleGoidelic = {
    type = character
    text = {
        trigger = {
            OR = {
                AND = {
                    is_independent_ruler = yes
                    root.faith = {
                        has_doctrine = tenet_struggle_submission
                    }
                }
                AND = {
                    exists = primary_spouse
                    root.primary_spouse = {
                        is_independent_ruler = yes
                        faith = {
                            has_doctrine = tenet_struggle_submission
                        }
                    }
                }
            }
        }
        localization_key = sultan_male_goidelic
    }
}

After setting up your conditional localization, I will recommend you set a fallback adding as the last text.

text = {
    fallback = yes
    localization_key = king_default_male_goidelic
}
KingMaleGoidelic = {
	type = character
	text = {
		trigger = {
			OR = {
				AND = {
					is_independent_ruler = yes
					root.faith = {
						has_doctrine = tenet_struggle_submission
					}
				}
				AND = {
					exists = primary_spouse
					root.primary_spouse = {
						is_independent_ruler = yes
						faith = {
							has_doctrine = tenet_struggle_submission
						}
					}
				}
			}
		}
		localization_key = sultan_male_goidelic
	}
	text = {
		fallback = yes
		localization_key = king_default_male_goidelic
	}
}
KingFemaleGoidelic = {
	type = character
	text = {
		trigger = {
			OR = {
				AND = {
					is_independent_ruler = yes
					root.faith = {
						has_doctrine = tenet_struggle_submission
					}
				}
				AND = {
					exists = primary_spouse
					root.primary_spouse = {
						is_independent_ruler = yes
						faith = {
							has_doctrine = tenet_struggle_submission
						}
					}
				}
			}
		}
		localization_key = sultan_female_goidelic
	}
	text = {
		fallback = yes
		localization_key = king_default_female_goidelic
	}
}
KingdomGoidelic = {
	type = character
	text = {
		trigger = {
			is_independent_ruler = yes
			root.faith = {
				has_doctrine = tenet_struggle_submission
			}
		}
		localization_key = sultanate_goidelic
	}
	text = {
		fallback = yes
		localization_key = kingdom_default_goidelic
	}
}

Now that we have conditions set, we will what to set all our flavor keys to call the custom loc. I will going over why we use this function in a later lesson, but for now most people can just remember this:

flavor_key:0 "[CHARACTER.Custom(‘CustomLocKey’)]"

Under this you can set the actual localization for your new keys.

king_male_goidelic_group:0 "[CHARACTER.Custom('KingMaleGoidelic')]"
king_female_goidelic_group:0 "[CHARACTER.Custom('KingFemaleGoidelic')]"
kingdom_goidelic_group:0 "[CHARACTER.Custom('KingdomGoidelic')]"
sultan_male_goidelic:0 "Sabdán"
sultan_female_goidelic:0 "Bansabdán"
sultanate_goidelic:0 "Sabdánacht"
king_default_male_goidelic:0 "Ardrí"
king_default_female_goidelic:0 "Ardrígan"
kingdom_default_goidelic:0 "Ardrígdacht"

With custom loc you can not only use other triggers, the order of conditions sets a new priority top to bottom as well. Let’s say you want another title that effects both Christians and Muslims, you can set it above the sultan text = { to make it come first.

You can also use it to over ride independent duchy names when the holder is a king or above like so:

GaelicIndepDuchy = {
    type = character
    text = {
        trigger = {
            highest_held_title_tier >= tier_kingdom
        }
        localization_key = duchy_default_gaelic # flavor title for duchies
    }
    text = {
        fallback = yes
        localization_key = independent_duchy_gaelic
    }
}
duchy_feudalclan_gaelic_independent:0 "[CHARACTER.Custom('GaelicIndepDuchy')]"
independent_duchy_gaelic:0 "Rígdacht"
duchy_default_gaelic:0 "Ardtiarnas"

Now for the complex example. I won’t be going over it but you’ll get to see what you can do. All of this is to allow dukes to have contract based titles, the ability to acquire the prince title in the HRE, HRE electorship titles, and titles for the Byzantine Theme system.

DukeMaleSicilian = {
    type = character
    text = {
        trigger = {
            exists = liege
            liege.primary_title = {
                has_title_law = princely_elective_succession_law
                any_elector = {
                    this = root
                }
            }
        }
        localization_key = kurfurst_male_sicilian
    }
    text = {
        trigger = {
            exists = primary_spouse
            root.primary_spouse = {
                exists = liege
                liege.primary_title = {
                    has_title_law = princely_elective_succession_law
                    any_elector = {
                        this = root.primary_spouse
                    }
                }
            }
        }
        localization_key = duke_male_sicilian_independent
    }
    text = {
        trigger = {
            OR = {
                vassal_contract_has_flag = has_march_contract
                AND = {
                    exists = primary_spouse
                    root.primary_spouse = {
                        vassal_contract_has_flag = has_march_contract
                    }
                }
            }
        }
        localization_key = marquess_male_sardinian
    }
    text = {
        trigger = {
            OR = {
                vassal_contract_has_flag = has_palatinate_contract
                AND = {
                    exists = primary_spouse
                    root.primary_spouse = {
                        vassal_contract_has_flag = has_palatinate_contract
                    }
                }
            }
        }
        localization_key = palatine_male_sardinian
    }
    text = {
        trigger = {
            root.top_liege = {
                has_primary_title = title:e_byzantium
            }
        }
        localization_key = byzantine_duke_male_sardinian
    }
    text = {
        trigger = {
            OR = {
                AND = {
                    exists = liege
                    liege.primary_title = {
                        has_title_law = princely_elective_succession_law
                    }
                    OR = {
                        AND = {
                            has_realm_law = crown_authority_1
                            liege = {
                                NOR = {
                                    has_realm_law = crown_authority_1
                                    has_realm_law = crown_authority_2
                                    has_realm_law = crown_authority_3
                                }
                            }
                        }
                        AND = {
                            has_realm_law = crown_authority_2
                            liege = {
                                NOR = {
                                    has_realm_law = crown_authority_2
                                    has_realm_law = crown_authority_3
                                }
                            }
                        }
                        AND = {
                            has_realm_law = crown_authority_3
                            liege = {
                                NOT = {
                                    has_realm_law = crown_authority_3
                                }
                            }
                        }
                    }
                }
                AND = {
                    exists = primary_spouse
                    root.primary_spouse = {
                        exists = liege
                        liege.primary_title = {
                            has_title_law = princely_elective_succession_law
                        }
                        OR = {
                            AND = {
                                has_realm_law = crown_authority_1
                                liege = {
                                    NOR = {
                                        has_realm_law = crown_authority_1
                                        has_realm_law = crown_authority_2
                                        has_realm_law = crown_authority_3
                                    }
                                }
                            }
                            AND = {
                                has_realm_law = crown_authority_2
                                liege = {
                                    NOR = {
                                        has_realm_law = crown_authority_2
                                        has_realm_law = crown_authority_3
                                    }
                                }
                            }
                            AND = {
                                has_realm_law = crown_authority_3
                                liege = {
                                    NOT = {
                                        has_realm_law = crown_authority_3
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        localization_key = duke_male_sicilian_independent
    }
    text = {
        localization_key = duke_default_male_sardinian
        fallback = yes
    }
}
DukeFemaleSicilian = {
    type = character
    text = {
        trigger = {
            exists = liege
            liege.primary_title = {
                has_title_law = princely_elective_succession_law
                any_elector = {
                    this = root
                }
            }
        }
        localization_key = kurfurst_female_sicilian
    }
    text = {
        trigger = {
            exists = primary_spouse
            root.primary_spouse = {
                exists = liege
                liege.primary_title = {
                    has_title_law = princely_elective_succession_law
                    any_elector = {
                        this = root.primary_spouse
                    }
                }
            }
        }
        localization_key = duke_female_sicilian_independent
    }
    text = {
        trigger = {
            OR = {
                vassal_contract_has_flag = has_march_contract
                AND = {
                    exists = primary_spouse
                    root.primary_spouse = {
                        vassal_contract_has_flag = has_march_contract
                    }
                }
            }
        }
        localization_key = marquess_female_sardinian
    }
    text = {
        trigger = {
            OR = {
                vassal_contract_has_flag = has_palatinate_contract
                AND = {
                    exists = primary_spouse
                    root.primary_spouse = {
                        vassal_contract_has_flag = has_palatinate_contract
                    }
                }
            }
        }
        localization_key = palatine_female_sardinian
    }
    text = {
        trigger = {
            root.top_liege = {
                has_primary_title = title:e_byzantium
            }
        }
        localization_key = byzantine_duke_female_sardinian
    }
    text = {
        trigger = {
            OR = {
                AND = {
                    exists = liege
                    liege.primary_title = {
                        has_title_law = princely_elective_succession_law
                    }
                    OR = {
                        AND = {
                            has_realm_law = crown_authority_1
                            liege = {
                                NOR = {
                                    has_realm_law = crown_authority_1
                                    has_realm_law = crown_authority_2
                                    has_realm_law = crown_authority_3
                                }
                            }
                        }
                        AND = {
                            has_realm_law = crown_authority_2
                            liege = {
                                NOR = {
                                    has_realm_law = crown_authority_2
                                    has_realm_law = crown_authority_3
                                }
                            }
                        }
                        AND = {
                            has_realm_law = crown_authority_3
                            liege = {
                                NOT = {
                                    has_realm_law = crown_authority_3
                                }
                            }
                        }
                    }
                }
                AND = {
                    exists = primary_spouse
                    root.primary_spouse = {
                        exists = liege
                        liege.primary_title = {
                            has_title_law = princely_elective_succession_law
                        }
                        OR = {
                            AND = {
                                has_realm_law = crown_authority_1
                                liege = {
                                    NOR = {
                                        has_realm_law = crown_authority_1
                                        has_realm_law = crown_authority_2
                                        has_realm_law = crown_authority_3
                                    }
                                }
                            }
                            AND = {
                                has_realm_law = crown_authority_2
                                liege = {
                                    NOR = {
                                        has_realm_law = crown_authority_2
                                        has_realm_law = crown_authority_3
                                    }
                                }
                            }
                            AND = {
                                has_realm_law = crown_authority_3
                                liege = {
                                    NOT = {
                                        has_realm_law = crown_authority_3
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        localization_key = duke_female_sicilian_independent
    }
    text = {
        localization_key = duke_default_female_sardinian
        fallback = yes
    }
}
DuchySicilian = {
    type = character
    text = {
        trigger = {
            highest_held_title_tier = tier_duchy
            is_male = yes
            exists = liege
            liege.primary_title = {
                has_title_law = princely_elective_succession_law
                any_elector = {
                    this = root
                }
            }
        }
        localization_key = kurfurstdom_male_sicilian
    }
    text = {
        trigger = {
            highest_held_title_tier = tier_duchy
            is_male = no
            exists = liege
            liege.primary_title = {
                has_title_law = princely_elective_succession_law
                any_elector = {
                    this = root
                }
            }
        }
        localization_key = kurfurstdom_female_sicilian
    }
    text = {
        trigger = {
            vassal_contract_has_flag = has_march_contract
        }
        localization_key = march_sardinian
    }
    text = {
        trigger = {
            vassal_contract_has_flag = has_palatinate_contract
        }
        localization_key = palatinate_sardinian
    }
    text = {
        trigger = {
            root.top_liege = {
                has_primary_title = title:e_byzantium
            }
        }
        localization_key = byzantine_duchy_sardinian
    }
    text = {
        trigger = {
            highest_held_title_tier = tier_duchy
            exists = liege
            liege.primary_title = {
                has_title_law = princely_elective_succession_law
            }
            OR = {
                AND = {
                    has_realm_law = crown_authority_1
                    liege = {
                        NOR = {
                            has_realm_law = crown_authority_1
                            has_realm_law = crown_authority_2
                            has_realm_law = crown_authority_3
                        }
                    }
                }
                AND = {
                    has_realm_law = crown_authority_2
                    liege = {
                        NOR = {
                            has_realm_law = crown_authority_2
                            has_realm_law = crown_authority_3
                        }
                    }
                }
                AND = {
                    has_realm_law = crown_authority_3
                    liege = {
                        NOT = {
                            has_realm_law = crown_authority_3
                        }
                    }
                }
            }
        }
        localization_key = independent_duchy_sicilian
    }
    text = {
        localization_key = duchy_default_sardinian
        fallback = yes
    }
}
duke_male_sicilian:0 "[CHARACTER.Custom('DukeMaleSicilian')]"
duke_female_sicilian:0 "[CHARACTER.Custom('DukeFemaleSicilian')]"
duchy_sicilian:0 "[CHARACTER.Custom('DuchySicilian')]"
kurfurst_male_sicilian:0 "Principi Eletturi"
kurfurst_female_sicilian:0 "Principissa Elettrici"
kurfurstdom_male_sicilian:0 "Principi Elettoratu"
kurfurstdom_female_sicilian:0 "Principissa Elettoratu”
duke_male_sicilian_independent:0 "Principi"
duke_female_sicilian_independent:0 "Principissa"
independent_duchy_sicilian:0 "Principatu"
#Same as Sardinian
marquess_male_sardinian:0 "Marchesi"
marquess_female_sardinian:0 "Marchesa"
march_sardinian:0 "Marca"
palatine_male_sardinian:0 "Palatinu"
palatine_female_sardinian:0 "Palatina"
palatinate_sardinian:0 "Palatinatu"
byzantine_duke_male_sardinian:0 "Strategi"
byzantine_duke_female_sardinian:0 "Strategissa"
byzantine_duchy_sardinian:0 "Thema"
duke_default_male_sardinian:0 "Duca"
duke_default_female_sardinian:0 "Duchissa"
duchy_default_sardinian:0 "Ducatu"