WordPress by default comes with a function known as wp_localize_script(). This function allows you to localize JavaScript strings. Well, with the help of snippet below, you will be able to make translatable JavaScript strings on your WordPress theme. Make sure you paste the following code into your function.php file.

Snippet Source/Credit: WPTheming.com