Support vanilla localization system
Adaptivity opened this issue ยท 18 comments
I know that Buildcraft already support localization. But it has several drawbacks.
Firstly, Buildcraft not supported UTF-8 encoding (That's very bad for languages which have only non-latin characters). Secondly, Buildcraft can't be fully translated (Messages about new version, quarry messages and etc). And finally structure of localization file in vanilla localization system is much better and pleasing to the eyes.
If it needed a lot of work or just not possible this issue can be closed.
- Any language characters can be encoded in ISO 8859-1. UTF-8 is just convenience.
- The translation is not 100 % perfect, some strings may be missing, but that's not really related to the localization system used. The quarry message should be removed anyway.
- Layout of the localization file isn't really all that different BC<->MC. Also rather a minor inconvencience.
tl;dr: Yes, this should probably be converted to vanilla localization at some point. It'd be quite a bit of work for little gain though and I don't see any advantage for the end user. I doubt anyone is going to touch this anytime soon.
About ".name" in lang file, it appears due to this code:
public String getItemDisplayName(ItemStack par1ItemStack)
{
return ("" + StatCollector.translateToLocal(this.getLocalizedName(par1ItemStack) + ".name")).trim();
}
(Item.java:607)
it can be circumvented by putting this code in ItemBuildcraft/ItemBlockBuildcraft :
public String getItemDisplayName(ItemStack stack)
{
return StatCollector.translateToLocal(this.getLocalizedName(stack)).trim();
}
But for encoding, lang files need to be updated :
Is there something to change the encoding automatically ISO 8859-1 -> UTF8 without BOM ?
I'll still do some test and I think can send the pull request.
(sorry for my bad english)
Benefits :
- UTF8 is easier to use, you just need to change configuration on notepad++, it will be easier for translators.
- The codes of the current localization systems can be deleted (even if it is not much, it's a few kb less)
Inconvenience :
- All translation files need to be updated due to the change of encoding and the .name in addition in the unlocalizedname.
I created a branch on my clone, I'll start working on it. (https://github.com/robin4002/BuildCraft/tree/vanillalocalization)
CovertJaguar is glad Railcraft already uses UTF8
Do please be aware that must be without BOM as well. Java doesn't like BOM.
Like I said there is no need for a new system, changing 3 lines is enough for UTF-8. Changing the system would need any submod using it to also change.
The current problem is the quarry message, with the current localization system it's impossible to translate quarry message, whereas with the vanilla system we can use ChatMessageComponent.func_111077_e("...");
As said SirSengir: "The quarry message should be removed anyway." So no need to make it translatable.
And I found something: http://i.imgur.com/W1UwMXl.png
I don't see a reason to change all this. You can support UTF8 by using a reader in the .load function instead of the input stream:
modMappings.load(langStream); -> modMappings.load(new InputStreamReader(langStream, "UTF-8"));
No need to change the whole system.
http://i.imgur.com/qSJ3d8A.png can this be translated too?
He already added it to the localization in his branch.
Sorry that was the return message.
You can easily convert ISO 8859-1 text to UTF-8 with this: http://code.cside.com/3rdpage/us/javaUnicode/converter.html
Insert the ISO text in the bottom field
Click "Hexadecimal codes to Characters" On the bottom of that field
And you have the UTF-8 text inside the top field
Also works vice-versa
Then e.g. put that UTF-8 text into Notepad++ and convert it into UTF-8 without BOM if necessary.
Now only someone needs to PullRequest a new localization system into this mod.
I am fine with the current Buildcraft Localization system, though.
As an FYI sengir, LanguageRegistry is going away, because it's an annoying hook and vanilla handles things better. I'll have a look at how hard using vanilla would be..
@CovertJaguar @SirSengir
Finally, use the vanilla localization system is interesting or not ?
If not, we should close this issue. If yes, I just have to send the pull request
The vanilla localization system is just as easy as putting the .lang files in assets/buildcraft/lang. No need for any loading code on bc's part.
Also, the languageRegistry from FML will be deprecated in the future because of this new system.
To robin4002
http://i.imgur.com/W1UwMXl.png There is no way to make it translatable?