Having a script to achieve this would require an immense amount of work, not to mention knowledge of the actual language rules and such.
However, it would be easier (though not something I would do, personally) to have someone translate the game, providing all the necessary translations, and have a script that simply replaces the text as appropriate. It would still be a large amount of work. Real companies employ third party people, or have a specialized internal team, to do the translations or localizations for them. For one thing, depending on the country/language you may also need to change the context of the writing, which is additional work still.
If you want to make your game easily available in other languages, you need to get some assistance from someone who wants to help bring your game to their demographic. Unless you can do that, I would suggest keeping your game in your own native language. RPG Maker games aren't the most popular, so the time spent on localization would not be worth it.