Language plugin

Discussion in 'Plugin Development' started by MajorSkillage, Jan 6, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    MajorSkillage

    Hi guys! I am posting here because it is not a request i just want to know who would work with me in this, i am making a plugin that translates the language for someone, i plan to do this by searching a string list of languages online for as much as i can and attempt to translate them to english, will anyone help me with this project or have a better idea on how to do it? Thanks!
     
  2. Offline

    jusjus112

    @MajorSkillage
    If you ask if anyone can help you. I think its the wrong section.
    But i can say you how to make it ^^

    Just make a new config/file and call them the language you want, like eng.yml or dutch.yml
    Then when the player joins, search for the file, and he sends the messages you have added to that file!
     
  3. Offline

    MajorSkillage

    Please do tell, i am sure many people would like a plugin like this and this is also why i posted here, because there may be a better way :)

    @jusjus112
    Would it be from a enum? I have a feeling that is what you are going to say instead of using a big fat list of a map or array i would use an enum?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
  4. Offline

    MisterErwin

    @MajorSkillage Depends on what you are going to translate.

    If you are only going to translate predefined messages, it will be fairly easy.

    But if you want to translate the chat.... That will be mostly not possible.

    And as a tip: There's a packet named Client Settings that sends you the selected locale of the player ;)
     
  5. Offline

    MajorSkillage

    Well on many populated servers especially i have seen people not speaking english when it's disallowed i just want to import an enum from somewhere like some sort of dictionary and detect chat on AsyncPlayerChatEvent and if the chat contains something from the list then it replaces it with the word in english from another enum or even better, in the enum make the english string values for the word then replace it :) And thanks for the tip :D but others do not seem to notice it that is what i am saying
     
  6. Offline

    MisterErwin

    @MajorSkillage Well... If you want to replace every word w/ the english translation:

    The Oxford English Dictionary contains 171,476 full entries. Your memory will say "thanks!"

    Then: You would have to check against every declination/konjugation of a word....

    So I would suggest looking at bayes' theorem
    That way you could block most non english sentences.

    @MajorSkillage I would suggest a real bayes in that case:
    http://blog.datumbox.com/developing-a-naive-bayes-text-classifier-in-java/

    And my time is limited atm, so.. nah

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
    MajorSkillage likes this.
  7. I'm interested to know if you have any actual figures to back this up. Personally I don't really know how much an average String in Java uses, but 90 bytes seemed to be the highest I found.

    So let's go with the assumption of 100 bytes per String, shall we? 171,476 different Strings at 100 bytes each is of course 17,147,600 bytes. As a megabyte is the same as 1,000,000 bytes, these Strings by my estimate will be using up a little over 17mb of RAM. So this isn't as much as you were expecting, I don't think. :p

    Of course, this was just a quick estimate based on some google searches. If you, or anyone for that matter, has actually put some time in to working out some averages, I'd love to hear the results.
     
  8. Offline

    MisterErwin

    @AdamQpzm Yeah... you got me...
    But the CPU.... :p
     
  9. Offline

    Skionz

    @MajorSkillage Doesn't google translate have an API that you could use?
     
  10. Offline

    MajorSkillage

    @Skionz Not sure but i am going to look into it
     
  11. @MajorSkillage Even if they don't (and because it's Google I'd be surprised if they didn't) I know for a fact there are translators out there that do have an API.

    Also bare in mind that translators are far from perfect, this might be frustrating to users :p
     
    MisterErwin likes this.
  12. Offline

    MajorSkillage

    or i could just, you know find a dictionary with the texts exactly how i want it for each language then make an enum and paste and get data from there instead x) (but i am rather lazy so API sounds good ;D)
     
  13. Offline

    jolbol1

    Google has an API.
     
  14. Offline

    MajorSkillage

    uhh great i ain't paying $ for it, enum it is now i will just have to write a quick java program so i can copy an index and paste so it will sort into a tidy arraylist for me so i can copy and paste my own code x) TY anyway
     
Thread Status:
Not open for further replies.

Share This Page