Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update languages.js and index.js to fix Punjabi translations, add support for both 'zh' and 'zh-cn' Simplified Chinese and both 'he' and 'iw' Hebrew translations, and allow for translation requests from any language URL #5

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ function translate(text, opts) {
opts.to = languages.getCode(opts.to);

return token.get(text).then(function (token) {
var url = 'https://translate.google.com/translate_a/single';
var tld = 'com';
var url = 'https://translate.google.' + {tld} + '/translate_a/single';
var data = {
client: opts.client || 't',
sl: opts.from,
Expand Down
4 changes: 3 additions & 1 deletion languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var langs = {
'ca': 'Catalan',
'ceb': 'Cebuano',
'ny': 'Chichewa',
'zh': 'Chinese Simplified',
'zh-cn': 'Chinese Simplified',
'zh-tw': 'Chinese Traditional',
'co': 'Corsican',
Expand All @@ -44,6 +45,7 @@ var langs = {
'ht': 'Haitian Creole',
'ha': 'Hausa',
'haw': 'Hawaiian',
'he': 'Hebrew',
'iw': 'Hebrew',
'hi': 'Hindi',
'hmn': 'Hmong',
Expand Down Expand Up @@ -81,7 +83,7 @@ var langs = {
'fa': 'Persian',
'pl': 'Polish',
'pt': 'Portuguese',
'ma': 'Punjabi',
'pa': 'Punjabi',
'ro': 'Romanian',
'ru': 'Russian',
'sm': 'Samoan',
Expand Down