Hello, Stonehearth Community!
In Russian language different words uses different word declensions depending on different cases. That is differs from English language.
So I want to make script that would automatically modifies endings of the words depending on different text cases. Probably “helpers.js” would help, but it is hard to understand program logic and I am not sure that this is good way.
Could someone explain mechanism of tags and which way is best for realisation of my target that described above?
Also I want to make script that modifies endings of female surnames (that ones differs from male surnames in Russian language)
I would think it would be better just to modify the localization text itself rather than trying to dynamically alter it with a script. And surnames can be changed by mixing into the corresponding population file, unless translation mods can’t modify files other than localization files?
I agree just translating seems the best
for the traders all you need is singular and plural
I think the names are chosen from a list probably with a gender tag of some kind
so also translation and perhaps adjusting he gender tag method
the hardest part of translating is making it actual laguage not the words translated and put together
I have stopped reading some translated light novels because the individual words were english but the text was not
I translated names and surnames. But the problem is that surnames do not have gender differences. That means that surnames list is joint for males and females. If I will create different surnames lists for each gender, I don’t know how to make the game understand, where to get that surnames. Also that will be very uncomfortable to make, because there is no major differences between male surnames and female surnames.
About main localisation file… Sometimes we can see strings like “chasing [name(data.target)]”. In that case I need different word declension of that target name. Also, if I just put additional word forms in the main localization file, that will cost too much time, because I need 12 different variations for EVERY object in the game
Russian language is a little bit more complex that you think In that case I need to create 12 (6 for singular + 6 for plural) different variations for EVERY object in the game. Also I can find text like “chasing [name(data.target)]”. I don’t know, how to modify that because I don’t know mechanism of this links.
Yeah, names list contains in gender tag, but surnames list is not.
Anyway, I need to know, how to make the game understand from where to get surnames
for the genders look into how it works in english
it’s a list of entire names ( last and first name)with gendertags
or a list of first names with gendertags and a list of last names without
or 2 lists of first names seperated by gender
I do not if you have looked into that aspect of the namessince you have not clearly stated it
typing at the same time and thinking
haveyou found tne list of last names
Yeah, I already translated it.
Lists looks something like that:
I can turn it into something like that:
But will the game understand this construction? I am not thinking so. I don’t know, how to make the game get surnames from
gender:surnames, not from
For surnames, then I’d recommend monkey-patching the
generate_random_name function. You can then either supply separate surnames by gender, or apply whatever modifications to the surname based on gender. Feel free to look at how ACE does monkey-patches (in the
stonehearth_ace_server.lua file and the
Oh, that is very helpful. Thank you!
But will that broke names of those, who already have English names?
Correct, it will only work for newly-generated names and will not affect existing entities. It’s a simple enough change to check in that function for gendered surnames, and maybe it’ll be useful for other people, so I can add that part of it to ACE.
Edit: The format I’ll use will be checking for
surnames within the gender first (alongside
given_names), and if not found, checking for
surnames under the regular role_data as it is now.
duplicate the structure of the given names for the surnames
female given names
the game already asks for a gender specific given name so it should be possible to copy tbat part of the code to surname selection
I will check this later.
But my question about different word declensions is still opend. I need to think about that later.
Thank you and all others for helping!
Yeah, I don’t think there’s a simple solution to that. If you haven’t already, maybe try looking into how other moddable games have handled dynamic localization to Russian (off the top of my head, maybe Factorio?) to see if there’s a systematic way to do that. Trying to modify the i18n helper functions is tricky, because the gender (or whatever other information you need) is probably not available alongside the custom name that’s being passed in. It could require changes to what data is stored/communicated in a number of places, plus everything that interacts with those systems.
I am thinked about finding the ends of the words and overwrite them to another ones. For example, I have the word “красивая” and I need to make another form of that word in specific case. For example, “красивую”. The ending of this word is “ая” and if data contains this chars with space either or chars are placed in the end of the text line, that will be turned into “ую”. That is my idea, but I need to understand “helpers.js”.
Also, I need somehow specify different word forms in the tags in the main locale file.
i18next is the library Stonehearth uses for localization, in case its documentation is helpful. Adding full support for declension is probably a significant amount of work, but the idea is that you would modify
localizeEntityName to take a second argument specifying the grammatical case of the context when detecting
name(), then have some heuristics for how to inflect words that match specific patterns. The latter would be pure JS string processing, that doesn’t care about any existing code.
Sometimes you can rephrase things in a way that doesn’t require declension, though it can sound less natural. E.g.:
"chasing [name(data.target)]" would naturally translate to
"в погоне за [name(data.target)]" but could also be phrased as
"в погоне. Цель: [name(data.target)]".
Just added gender support for surnames! Thank you again for helping!