Destroy: Chemistry and Carnage

Destroy: Chemistry and Carnage

71 Downloads

Translating Names of Salts

helloworld069 opened this issue · 2 comments

commented

The particular issue

In order to translate the names of simple salts, for example, sodium sulfate(硫酸钠), destroy.chemical.sulfate would be translated as 硫酸, destroy.chemical.sodium would as 钠. However, 硫酸(acid of sulfur) at the same time means sulfuric acid, while sulfate should be translated as 硫酸盐(salt formed by sulfuric acid). In short terms, the existing naming system for chemicals doesn't fits the needs of Chinese translation.

Suggestions for solutions

Currently, we have two lines for each substance in the lang file, for example, sulfate:

"destroy.chemical.sulfate": "sulfate",
"destroy.chemical.sulfate.iupac": "sulfate",

I suggest adding an extra line, the text in which used for assembling names of salts. For example:
in en_us:

"destroy.chemical.sulfate": "sulfate",
"destroy.chemical.sulfate.iupac": "sulfate",
"destroy.chemical.sulfate.assembly": "sulfate",

Three texts remains the same in en. However in zh_cn there will be differences:

"destroy.chemical.sulfate": "硫酸根",
"destroy.chemical.sulfate.iupac": "硫酸根",
"destroy.chemical.sulfate.assembly": "硫酸",

When generating the name of sodium sulfate, the .assembly part will be used instead of .iupac, allowing the name of it correctly translated as 硫酸钠, while the substance sulfate is correctly translated as 硫酸根 instead of 硫酸.
This is only just a rough idea, and I'm not sure if it's practicable, since I know little about modding. There could be similar ways available to address this issue.

Why such an issue(less important)

Chemicals are named in Chinese with a logic that has differences to English. Here are some examples in comparison:

  • English↔Chinese
  • Sodium 钠
  • Sulfur 硫
  • Acid 酸
  • Sulfuric Acid 硫酸
  • Salt 盐
  • Sulfate 硫酸盐
  • Ion 离子
  • Sulfate Ion 硫酸根/硫酸根离子
  • Sodium 钠
  • Sodium Sulfate 硫酸钠
  • Chlorine 氯
  • Sodium Chloride 氯化钠

Pay special attention to Sodium Sulfate and Sodium Chloride. In English, their names are the simple combination of the cation Sodium and Sulfate/Chloride.
In Chinese, however, the names of salts can be roughly sorted into two cases: For salts of oxyacids like Sulfuric Acid, their names are comprised of the name of the acid(in this instance, 硫酸) and the cation(钠);
And when it comes to salts like those containing only two elements, they're named as the names of the two elements with a ‘化’(which means react here) between them.
So the result is that you can't use the same way to piece up the names of the ions to form the name of a salt.

commented

Yeah, I kind of anticipated this would be a problem in other languages. I'll fix this in 0.4.

commented

Alright, I've implemented a solution called "Salt Name Overrides". It'll be a part of 0.4, but you can see how it works in the push I just made. It allows certain salts to have special names (e.g. sodium chloride = brine), which is a useful feature anyway, but also allows for the finer control over naming of salts such as is required for your issue.

Hopefully if you just look at that file you should roughly understand how it works. The file is a JSON object mapping Molecule IDs to objects which can contain one or both of the generic and specifics fields.

Generic Overrides

generic is a translation key. If this is specified, then the molecule will use that name rather than its usual name (destroy.chemical.<moleculename>) when its part of a salt. E.g.:

"destroy:iron_iii": {
    "generic": "destroy.chemical.ferric"
}

If an Iron (III) ion comprises a salt, it will now refer to destroy.chemical.ferric rather than destroy.chemical.iron_iii. In this case, this will cause Iron (III) Chloride to show as Ferric Chloride, Iron (III) Nitrate as Ferric Nitrate, etc. It applies to all salts that that ion is in. However, Iron (III) on its own will still be named Iron (III), or whatever is specified at destroy.chemical.iron_iii.

This will also search for destroy.chemical.ferric.iupac if IUPAC mode is enabled. However, if it can't find the IUPAC key, it will default to not applying the override. This means it will go with destroy.chemical.iron_iii.iupac or destroy.chemical.iron_iii and not destroy.chemical.ferric.

Specific Overrides

specifics is a JSON object mapping molecules to translation keys. If a specific key is given for a cation + anion combo, that name will override any others. E.g.:

"destroy:potassium_ion": {
    "specifics":  {
        "destroy:nitrate": "destroy.chemical.saltpeter"
    }
}

This will cause Potassium Nitrate to show as the translation with key destroy.chemical.saltpeter, which in this case is Saltpeter. This would also work with:

"destroy:nitrate": {
    "specifics":  {
        "destroy:potassium_ion": "destroy.chemical.saltpeter"
    }
}

This Bug Report

So in your case, you would want to add this to ...assets/destroy/lang/salt_name_overrides/zh_cn.json:

"destroy:sulfate": {
    "generic": "destroy.chemical.sulfate.salt"
}

And have the key destroy.chemical.sulfate.salt being 硫酸. Importantly though, you must also specify destroy.chemical.sulfate.salt.iupac as 硫酸, as if it does not find the IUPAC key, it will default to not applying the override at all and it will end up as 硫酸根.