Closed Adaptivity closed 10 years ago
There are some vanilla forestry alleles that return "for" prefixes or unlocalized strings.
I've fixed some of that in this commit tho there is still a bunch of broken stuff. Not sure if on my or forestry side. It's a pain in the arse.
I'll read through that issue when i have time, though if you can give me a TL;DR of what needs to be done on my side that would be awesome.
Also i don't like "Species are always in english", i will keep the ability to localize species added by this mod and respect whatever the other mods do for their species. If a localizer doesn't want to translate species he can skip them and it'll fall back to english.
Calling @Vexatos I think he knows what you should do.
If you do not want the "for" modifier, use StatCollector.translateToLocal instead of StringUtil.localize (the "for:" modifier is the only difference between those things).
I'm not using StringUtil.localize, that's how they are returned from IAllele.getName() which should be human readable.
Wait it think i was testing with an old build, looks like it's already fixed, let me test again...
I'm using Forestry build 90 and Gendustry 1.3.1 from here: http://bdew.net/gendustry/
Edit: @Vexatos can you take a look into custom bees names localization? How it should works in Forestry addons like Gendustry, Magic Bees, Extra Bees etc
@Adaptivity: Currently the custom names there will have to have the exact same pattern, so for.bees.custom.<type>.<species>
. I am sure there is the risk of things overlapping if two addons add the same species (maybe that doesn't matter as the same species usually also has the same localized name). I will look into fixing it, although I am not sure how I could do that since all bees, no matter from which mod, are exactly the same item. For now, addon translators will have to use the exact same pattern as forestry translators, I guess.
Not sure if there are exist same species in addons. Just tried to add custom names to Gendustry and they not working. Maybe it required some special code on Gendustry side?
I don't know, it might, you could look into how exactly custom bee names are done in https://github.com/ForestryMC/ForestryMC/blob/master/src/main/java/forestry/apiculture/items/ItemBeeGE.java#L70. I assume it looks for the custom string in the forestry localization file, so I don't know how I could fix this. The problem is that gendustry adds special kinds of an item forestry adds, so forestry is looking for the forestry localization file when doing custom names. I might need to add a method in StringUtil to get the name from different localization files, although that would be pretty ugly code as a mod is not supposed to look into other mod's localization files, unfortunately; I hope there is some better way to fix it, maybe @bdew has an idea.
I've checked again using a newer build of forestry and the last build of gendustry (http://jenkins.bdew.net/) and it looks like most template/samples text is ok. The only broken thing i see is fruit names and it's broken on forestry side.
About custom names:
Lots of cringe-worthy usages of String.replace there :P
Try using the full uid, eg for.bees.custom.
So putting a individual.getGenome().getPrimary().getUID() inbetween? I will try that.
Regarding fruit names: how do they currently look when you start gendustry?
Sory not the UID, the getUnlocalizedName()... I've tested and it works:
for.bees.custom.drone.gendustry.bee.species.black=Foo
Shows foo as the drone name.
Forestry does
.getUnlocalizedName().replace("bees.species.","")
To remove the prefix, but that prefix doesn't exist in my names, so the whole unlocalized name remains.
Ah, that's what you mean, so just remove the .replace("bees.species.","")
at the end so it uses the full unlocalized name, okay. This will make the string a lot more ugly, but it'll work....
Wait..... if I replace "bees.species." with "" in that custom key, wouldn't the current custom string be for.bees.custom.drone.gendustry.black=Foo
? If that's the case, it would be very, very nice.
The replace doesn't do anything right now for my bees because they use "bee.species" without the s.
If you want i can change it to have the S so you will have less ugly strings.
Ah, maybe you could adapt your species names to the forestry ones? If they are uniform, would the sting then work? If the unlocalized name of the primary allele is gendustry.bees.species.black
, then the custom name key would automatically resolve to for.bees.custom.drone.gendustry.black
and thus be looking much cleaner.
It works! Nice. The next step: beealyzer names. for.bees.custom.beealyzer.drone.gendustry.bee.species.black for example?
To make sure: for.bees.custom.drone.gendustry.black
does actually work? Nice!
I think he meant the longer version. I'll push a change to make it shorter in a sec
"for.bees.custom.drone.gendustry.bee.species.black" works :smile:
Okay, if you adapt the bee.species to bees.species, the custom bee names and the beealyzer names would be fine, as those are done the same way, so they should be for.bees.custom.beealyzer.drone.gendustry.black
after the gendustry.bee.species
key has been changed to gendustry.bees.species
.
"for.bees.custom.drone.gendustry.black" Should work now
for.bees.custom.beealyzer.drone.gendustry.black
for the custom beealyzer names should work as well.
Will test it right now. You guys can kill me but I need custom names for it (For trees names): http://i.imgur.com/KSYJyaj.jpg :smile: Minor but it would be cool.
Well, there are already custom treealyzer tree species names. Pattern being for.trees.custom.treealyzer.<type>.<species>
. I don't know what those special tree species types there are. But @bdew Might just use the custom treealyzer species names for them (See https://github.com/ForestryMC/ForestryMC/blob/master/src/main/java/forestry/arboriculture/gui/GuiTreealyzer.java#L153) or implement their own custom keys in the same way.
How string will look for Gendustry templates?
Ugh, templates/samples don't have a type tho. Does it really make sense to use those for them? It's just the species name, not the name of a bee/drone/sapling/pollen/whatever?
Edit: The templates right now use the API getName() to get a localized name, so the key name is up to whomever provides the species.
@bdew The same I did with beealyzer + treealyzer names. Only the species shows up there, but it differs from the species defined in trees.species.something in languages like Russian depending on which type is used. If you do it like I did in GuiTreealyzer, you will be safe.
I need to modify specie name. Example: Genetic Template Species: Plum (Forestry name) I should change this name.
Edit: Actually these names already in Forestry ru_RU.lang under CUSTOM Beealyzer/Treealyzer NAMES category. As said Vexatos.
Edit2: http://i.imgur.com/XmdM9Eo.jpg and http://i.imgur.com/LmdxDJH.jpg These names not working. Also, Vexatos, you should take a look at missing fruit names.
So, you either just use the ones appearing in the beealyzer/treealyzer, or just make your own custom key the same way.
Is that ok? It uses the bee/treealyzer string, defaulting to types "drone" and "sapling"
Will test it. Can you take a look at Edit2 in post above Vexatos?
That's what forestry returns for growth alleles (with for. stripped) instead of a localized name.
Forestry localization has
for.gui.growth.normal=Light
for.gui.growth.tropical=Tropical
Note the "gui" that either shouldn't be there or should be used in a custom AlleleGrowth.getName
I will take a look at that, thanks for pointing out.
Okay, it's done. Only Forestry issues left.
I removed the "gui" from the growth names, just for your information. It's true, they shouldn't be there. @bdew Just use AlleleGrowth.getProvider().getDescription() to get the localized growth name.
Localization in new Forestry changed a lot. Now Forestry supports custom bees/trees names and much more. You can check what has been changed here: https://github.com/ForestryMC/ForestryMC/issues/118
Current issues in latest version of Gendustry: 1) A lot of missing text. You can easily found it by checking "Genetic Samples" and "Genetic Templates" tabs in Creative mode. This text differs from the other because it has "for." prefix. It also can be vanilla Forestry issue but I'm not sure about it. 2) Bees species names no longer uses localization. They now uses English names. Probably due to a lot of changes in vanilla Forestry. It should be fixed and you should add "Custom bees species names" support. You should check issue 118 about which I referred above. Edit: Bees species now uses localization. That was strange. But custom names not working.