I'm asking this because I'm returning to my project of completing the localization of Stellaris!
I recall that currently, if name lists can be localized by modders (because they aren't in vanilla game), then it's another story for all that depends on syntactic rules (e.g. grammatical accord, elision rules, ...), leading sometimes to a feeling of a pidgin whenever a country name is used (as in any other game strongly relying on scripted text, btw).
For example, speaking of the dynamic key 'GetEdibleName', defined in /common/scripted_loc/00_scripted_loc.txt:
Code:
# Allows you to create your own dynamic keys
# to be called in localization.
# defined_text -> this is it, we're defining the text
# text -> a discrete entry that can be picked to display in loc.
# trigger -> determines if a text entry will be picked or not.
# (The triggers need to be valid for the scope the key is called in
# (eg Root or From.From).)
# localization_key -> points to the localization key
# that'll be used if trigger passes
defined_text = { # Country/leader/pop/species scope
name = GetEdibleName
text = {
trigger = {
is_species_class = AVI
}
localization_key = edible_avi #Chicken Nugget
}
text = {
trigger = {
is_species_class = MAM
}
localization_key = edible_mam #Burger
}
(...)
}
Where the localization keys are to be found in /localisation/english/scripted_loc_l_english.yml.
The idea would be to define a custom dynamic key in some file in /common/scripted_loc/ (because I guess that they can't be defined elsewhere), using the value of a custom variable, which would be set in, say /common/random_names/00.empire_names.txt:
Code:
# Imperial Militarist 1
empire_name_format = {
random_weight = {
factor = 0
modifier = {
add = 1
OR = {
has_government = "gov_star_empire"
has_government = "gov_martial_empire"
}
is_pirate = no
is_primitive = no
NOT = { is_country_type = fallen_empire }
NOT = { is_country_type = awakened_fallen_empire }
}
}
format = "format.imp_mil.1"
###
set_variable = { wich = keyName_info value = 10 } # <<<<<< only a float/integer/variable name/'owner'
###
noun = "[This.Capital.System.GetName]"
prefix_format = "<imperial_mil> [This.Capital.System.GetName]"
defined text =
# Empire of Sol
}
Where 'keyName_info' would be the same local variable used for every empire name format, and its value would be stored/associated within each random empire/country, such as a dynamic key could then be defined using it:
Code:
defined_text = { # Country scope
name = GetInfoCtry
###
set_variable = { which = keyName_info value = owner } # <<<<<< 'owner' to retrieve the value previously set in owner scope (???)
###
text = {
trigger = {
keyName_info = 10
}
localization_key = key_masc # He
}
text = {
trigger = {
keyName_info = 20
}
localization_key = key_fem # She
}
text = {
trigger = {
keyName_info = 30
}
localization_key = key_neut # It
}
}
Where the localization keys would be added in the proper /localisation/english/scripted_loc_l_XXX.yml file.
Of I could rather set the variable name in the father script, and then set its value in the (child) empire format script?