TranxCraft / iTranxCraft

The Rewrite Of TranxCraft - a custom plugin that does many wonderful things.
3 stars 1 forks source link

Language Packs #49

Open Kent55 opened 9 years ago

Kent55 commented 9 years ago

Although not mandatory, I personally feel that this would be a great addition, not only for those that wish to use TranxCraft from different countries, but it also makes managing output messages easier and encourages the community to contribute by translating. So, in the end, TranxCraft could be supported in many languages.

A possible way to do it would be to create a directory called languages, and then name each file with its relevant locale, i.e. en, fr etc. Inside each file have different constants, for example:

MESSAGE_FORUM_ACCOUNT_NOT_EXIST ERROR_NO_PERMISSION

etc...

In the database we can store the selected locale of the user in a field, then load the relevant file depending on the field value, defaulting to english of course.

I can then do the same for the panel, fetching the same field from the database. I would love to know what you think @WickedGamingUK

Fyrsta commented 9 years ago

It would be a good idea, not a priority though.

Wild1145 commented 9 years ago

This should be implemented sooner rather than later else it will be a huge pain in the ass later on. The longer you leave it, the more work you will have.

Fyrsta commented 9 years ago

@Wild1145 That's true, I'd rather get the core problems solved first.

Wild1145 commented 9 years ago

@WickedGamingUK True, but if you create the messages as you go along it will just make it easier, and will not make such a huge issue later on.

Fyrsta commented 9 years ago

@Wild1145 It would require development and testing first before being able to be used, time that should go into fixing bugs first though.

Wild1145 commented 9 years ago

@WickedGamingUK Regardless of the initial time to take, it will save a lot of time over the life span of the project. If you want to have this, you should implement it now, or just not bother.

Fyrsta commented 9 years ago

@Kent55 With this, is there anything wrong with storing everything in the database?

Kent55 commented 9 years ago

@WickedGamingUK The only downside with a database is that you have to do a lot of queries, therefore it slows performance down. The only reason to store anything but the locale field would be if you were wanting to easily change phrases, but people can just create a new XML file for new languages and we can change phrases from the files themselves.

Personally for what TranxCraft is I don't see why we need to store everything in a database, seems like we'd be adding pointless queries when really we just need to store registered users locale in a field and logged out users locale in a session variable. Then we just parse the relevant XML file. We could then cache it. We can then rebuild the languages once every day for example. Or when they change their default language etc.

Then again we could use a database but then we would definitely need to cache it...It really depends on what you have in mind regarding what users can do.

Fyrsta commented 9 years ago

@Kent55 Yeah, storing the messages in XML or similar format would probably be easier. It wouldn't be as easy to modify the file on the server from a web panel, though. Via #42 we would need to send the file to the web panel and do it back the same way, or do it through SFTP.

Kent55 commented 9 years ago

@WickedGamingUK If you want to be able to modify languages from the web panel and allow users who translate for us to do the same then we are better off storing it in a database otherwise XML.

Wild1145 commented 9 years ago

@WickedGamingUK @Kent55 Surly there should be no needs to instantly update the language packs? Storing in XML sounds like the better choice here because once the packs are done they will only need to be edited when you add new messages in the plugin (Generally) so you need to reload / restart the server to apply those changes, so when that reload / restart happens the new XML file would be loaded in for use. Unless I am missing something, XML sounds like the best choice.

Kent55 commented 9 years ago

@Wild1145 Thank you. @WickedGamingUK That's what I've been trying to say :p