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

Maximum text lenght is 1000 #32

Closed
MahmutHizal opened this issue Dec 7, 2023 · 10 comments
Closed

Maximum text lenght is 1000 #32

MahmutHizal opened this issue Dec 7, 2023 · 10 comments

Comments

@MahmutHizal
Copy link

Hello, I encountered a problem. When the text length is more than 1000 characters, the package throws an error. The error appears to be caused by the Bing Translation API reaching its maximum text length. How can I solve this problem? I would also like to use your package with longer texts. I would be glad if you help. Thanks.

@plainheart
Copy link
Owner

The latest v2.10.0 has increased the text length to 5000. If you are using this version and think it is still not enough, you have to split the text to multiple blocks.

@MahmutHizal
Copy link
Author

I am already using version 2.10.0. When I try to set the text length to 1001 characters, I get an empty error message from Bing. When I set the text length to 999, it translates without any errors.

@plainheart
Copy link
Owner

I think it's not possible and I just tested with the following code. Please check the version again in node_modules/bing-translate-api/package.json.

translate(new Array(5000).fill('0').join(''), null, 'en')

@MahmutHizal
Copy link
Author

image

First Try(5000 Chars)

node.js cli output

root@45:/home/sammy# node app.js
Server is running
Error: Something went wrong!
Response status: 200 (OK)
Response body  : {"statusCode":400,"errorMessage":""}
    at wrapRequest (/home/sammy/node_modules/bing-translate-api/src/index.js:213:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async translate (/home/sammy/node_modules/bing-translate-api/src/index.js:289:16)
    at async file:///home/sammy/routes/bingRoutes.js:43:29

My dummy text(5000 chars)

But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains. But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce with righteous indignation and dislike men who are so beguiled

Second Try(1001 Chars)

node.js cli output

Error: Something went wrong!
Response status: 200 (OK)
Response body  : {"statusCode":400,"errorMessage":""}
    at wrapRequest (/home/sammy/node_modules/bing-translate-api/src/index.js:213:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async translate (/home/sammy/node_modules/bing-translate-api/src/index.js:289:16)
    at async file:///home/sammy/routes/bingRoutes.js:43:29

Dummy Text(1001 Chars)

But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denounce

Third Try(999 Chars)

node.js cli output

Nothing! Good.

Dummy Text(999 Chars)

But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure? On the other hand, we denoun

Successfully Translated Text:

Ama size hazzı kınamak ve acıyı övmek gibi tüm bu yanlış fikirlerin nasıl doğduğunu açıklamak zorundayım ve size sistemin tam bir açıklamasını vereceğim ve gerçeğin büyük kaşifi, insan mutluluğunun usta kurucusunun gerçek öğretilerini açıklayacağım. Hiç kimse hazzın kendisini reddetmez, sevmez veya kaçınmaz, çünkü bu zevktir, ancak rasyonel olarak hazzın peşinden gitmeyi bilmeyenler son derece acı verici sonuçlarla karşılaşırlar. Ne de kendi acısını elde etmeyi seven, peşinden koşan ya da arzulayan kimse yoktur, çünkü bu acıdır, ama ara sıra zahmet ve acının ona büyük bir zevk verebileceği durumlar ortaya çıkar. Önemsiz bir örnek vermek gerekirse, hangimiz bundan bir avantaj elde etmek dışında zahmetli fiziksel egzersiz yaparız? Ama can sıkıcı sonuçları olmayan bir zevkten zevk almayı seçen ya da sonuçta hiçbir zevk vermeyen bir acıdan kaçınan bir insanda kusur bulmaya kimin hakkı var? Öte yandan, kınıyoruz

Note:

router.post('/translate', rateLimit({
    windowMs: 60 * 1000, // 1 dakika
    max: 200, // 1 dakikada en fazla 200 istek
    handler: (req, res, next) => {
        res.status(429)
            .json({ error: 'Çok fazla istek yaptınız. Lütfen bir süre sonra tekrar deneyin.' });
    },
}), [
    body('text').notEmpty().isString().isLength({ max: 5000 }).withMessage('İstek metni 1000 karakteri geçemez'),
    body('from').custom((value) => validateLanguageCode(value)).notEmpty().withMessage('Çevirilen dil geçerli değil.'),
    body('to').custom((value) => validateLanguageCode(value)).notEmpty().withMessage('Çevirilecek dil geçerli değil.'),
    body('raw').optional().isBoolean().withMessage('raw değeri şu an çok değerli ')
],
    validateRequestBody
    ,async (req, res) => {
    try {
        // İstekten gelen veriler
        const { text, from, to, raw } = req.body;

        // translate fonksiyonunu çağırma
        const translation = await translate(text, from, to, false, raw);

        // Çeviri sonucunu JSON formatında client'a gönderme
        res.json({ translation: translation.translation });
    } catch (error) {
        // Hata durumunda uygun bir response gönderme
        console.error(error);
        res.status(500).json({ error: 'Internal Server Error' });
    }
});

@plainheart
Copy link
Owner

It works well for me. Can you clone this repo and run the following commands to see if the field maxTextLen value in src/config.json is 5000?

npm i
npm run gen:config

@MahmutHizal
Copy link
Author

PS C:\Users\xxx\Downloads\bing-translate-api-master> npm i

added 44 packages, and audited 45 packages in 2s

20 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
PS C:\Users\xxx\Downloads\bing-translate-api-master> npm run gen:config

> bing-translate-api@2.10.0 gen:config
> node scripts/generate-config.js

✔️ Generated config
 {
  websiteEndpoint: '/translator',
  translateEndpoint: '/ttranslatev3?isVertical=1&',
  spellCheckEndpoint: '/tspellcheckv3?isVertical=1&',
  maxTextLen: 1000,
  maxCorrectableTextLen: 50,
  correctableLangs: [
    'da',      'en',      'nl',
    'fi',      'fr',      'fr-CA',
    'de',      'it',      'ja',
    'ko',      'no',      'pl',
    'pt',      'pt-PT',   'ru',
    'es',      'sv',      'tr',
    'zh-Hant', 'zh-Hans'
  ],
  userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0'
}

✔️ Generated language map
 {
  af: 'Afrikaans',
  sq: 'Albanian',
  am: 'Amharic',
  ar: 'Arabic',
  hy: 'Armenian',
  as: 'Assamese',
  az: 'Azerbaijani',
  bn: 'Bangla',
  ba: 'Bashkir',
  eu: 'Basque',
  bho: 'Bhojpuri',
  brx: 'Bodo',
  bs: 'Bosnian',
  bg: 'Bulgarian',
  yue: 'Cantonese (Traditional)',
  ca: 'Catalan',
  lzh: 'Chinese (Literary)',
  'zh-Hans': 'Chinese Simplified',
  'zh-Hant': 'Chinese Traditional',
  hr: 'Croatian',
  cs: 'Czech',
  da: 'Danish',
  prs: 'Dari',
  dv: 'Divehi',
  doi: 'Dogri',
  nl: 'Dutch',
  en: 'English',
  et: 'Estonian',
  fo: 'Faroese',
  fj: 'Fijian',
  fil: 'Filipino',
  fi: 'Finnish',
  fr: 'French',
  'fr-CA': 'French (Canada)',
  gl: 'Galician',
  lug: 'Ganda',
  ka: 'Georgian',
  de: 'German',
  el: 'Greek',
  gu: 'Gujarati',
  ht: 'Haitian Creole',
  ha: 'Hausa',
  he: 'Hebrew',
  hi: 'Hindi',
  mww: 'Hmong Daw',
  hu: 'Hungarian',
  is: 'Icelandic',
  ig: 'Igbo',
  id: 'Indonesian',
  ikt: 'Inuinnaqtun',
  iu: 'Inuktitut',
  'iu-Latn': 'Inuktitut (Latin)',
  ga: 'Irish',
  it: 'Italian',
  ja: 'Japanese',
  kn: 'Kannada',
  ks: 'Kashmiri',
  kk: 'Kazakh',
  km: 'Khmer',
  rw: 'Kinyarwanda',
  'tlh-Latn': 'Klingon (Latin)',
  gom: 'Konkani',
  ko: 'Korean',
  ku: 'Kurdish (Central)',
  kmr: 'Kurdish (Northern)',
  ky: 'Kyrgyz',
  lo: 'Lao',
  lv: 'Latvian',
  ln: 'Lingala',
  lt: 'Lithuanian',
  dsb: 'Lower Sorbian',
  mk: 'Macedonian',
  mai: 'Maithili',
  mg: 'Malagasy',
  ms: 'Malay',
  ml: 'Malayalam',
  mt: 'Maltese',
  mr: 'Marathi',
  'mn-Cyrl': 'Mongolian (Cyrillic)',
  'mn-Mong': 'Mongolian (Traditional)',
  my: 'Myanmar (Burmese)',
  mi: 'Māori',
  ne: 'Nepali',
  nb: 'Norwegian',
  nya: 'Nyanja',
  or: 'Odia',
  ps: 'Pashto',
  fa: 'Persian',
  pl: 'Polish',
  pt: 'Portuguese (Brazil)',
  'pt-PT': 'Portuguese (Portugal)',
  pa: 'Punjabi',
  otq: 'Querétaro Otomi',
  ro: 'Romanian',
  run: 'Rundi',
  ru: 'Russian',
  sm: 'Samoan',
  'sr-Cyrl': 'Serbian (Cyrillic)',
  'sr-Latn': 'Serbian (Latin)',
  st: 'Sesotho',
  nso: 'Sesotho sa Leboa',
  tn: 'Setswana',
  sn: 'Shona',
  sd: 'Sindhi',
  si: 'Sinhala',
  sk: 'Slovak',
  sl: 'Slovenian',
  so: 'Somali',
  es: 'Spanish',
  sw: 'Swahili',
  sv: 'Swedish',
  ty: 'Tahitian',
  ta: 'Tamil',
  tt: 'Tatar',
  te: 'Telugu',
  th: 'Thai',
  bo: 'Tibetan',
  ti: 'Tigrinya',
  to: 'Tongan',
  tr: 'Turkish',
  tk: 'Turkmen',
  uk: 'Ukrainian',
  hsb: 'Upper Sorbian',
  ur: 'Urdu',
  ug: 'Uyghur',
  uz: 'Uzbek (Latin)',
  vi: 'Vietnamese',
  cy: 'Welsh',
  xh: 'Xhosa',
  yo: 'Yoruba',
  yua: 'Yucatec Maya',
  zu: 'Zulu'
}

✔️ Generated dts from template

✔️ Generated README.md from template

config.json:

{
  "websiteEndpoint": "/translator",
  "translateEndpoint": "/ttranslatev3?isVertical=1&",
  "spellCheckEndpoint": "/tspellcheckv3?isVertical=1&",
  "maxTextLen": 1000,
  "maxCorrectableTextLen": 50,
  "correctableLangs": [
    "da",
    "en",
    "nl",
    "fi",
    "fr",
    "fr-CA",
    "de",
    "it",
    "ja",
    "ko",
    "no",
    "pl",
    "pt",
    "pt-PT",
    "ru",
    "es",
    "sv",
    "tr",
    "zh-Hant",
    "zh-Hans"
  ],
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0"
}

@plainheart
Copy link
Owner

plainheart commented Dec 13, 2023

It looks like the maximum text length is still 1000 in your area. I think I should fetch the maxTextLen configuration dynamically, instead of hard coding it.

For a long text, you can split it into multiple blocks to translate one by one.

@MahmutHizal
Copy link
Author

Yes, in my region the maxTextLen is 1000.
Thank you for your suggestion. However, I'll stick with Google Translate instead of Bing Translate. I will follow the developments.
Enjoy your work

@plainheart
Copy link
Owner

Hi @MahmutHizal, I changed the default maxTextLen back to 1000 in v3.3.0 since 5000 is only supported in China. And in this new version, I added a new EPT mode that has a lower (or no?) rate limit. It would be great if you could check out the latest code of the main branch and leave your feedback.

@MahmutHizal
Copy link
Author

Hi @MahmutHizal, I changed the default maxTextLen back to 1000 in v3.3.0 since 5000 is only supported in China. And in this new version, I added a new EPT mode that has a lower (or no?) rate limit. It would be great if you could check out the latest code of the main branch and leave your feedback.

Hello,
I didn't have much time, so I downloaded the latest master branch and ran npm run gen:config and npm run test, and I'm providing the output below.

PS C:\Users\xxx\Downloads\bing-translate-api-master> npm run gen:config

> bing-translate-api@3.0.0 gen:config
> node scripts/generate-config.js

✔️ Generated config
 {
  websiteEndpoint: '/translator',
  translateEndpoint: '/ttranslatev3?isVertical=1&',
  spellCheckEndpoint: '/tspellcheckv3?isVertical=1&',
  maxTextLen: 1000,
  maxTextLenCN: 5000,
  maxCorrectableTextLen: 50,
  maxEPTTextLen: 3000,
  correctableLangs: [
    'da',      'en',      'nl',
    'fi',      'fr',      'fr-CA',
    'de',      'it',      'ja',
    'ko',      'no',      'pl',
    'pt',      'pt-PT',   'ru',
    'es',      'sv',      'tr',
    'zh-Hant', 'zh-Hans'
  ],
  eptLangs: [
    'af', 'sq',  'am',      'ar',      'hy',      'az',
    'bn', 'bs',  'bg',      'ca',      'zh-Hans', 'zh-Hant',
    'hr', 'cs',  'da',      'prs',     'nl',      'en',
    'et', 'fil', 'fi',      'fr',      'de',      'el',
    'gu', 'ht',  'he',      'hi',      'hu',      'is',
    'id', 'iu',  'ga',      'it',      'ja',      'kn',
    'kk', 'km',  'ko',      'ku',      'lo',      'lv',
    'lt', 'mg',  'ms',      'ml',      'mt',      'mr',
    'my', 'mi',  'ne',      'nb',      'or',      'ps',
    'fa', 'pl',  'pt',      'pt-PT',   'pa',      'ro',
    'ru', 'sm',  'sr-Cyrl', 'sr-Latn', 'sk',      'sl',
    'es', 'sw',  'sv',      'ta',      'te',      'th',
    'to', 'tr',  'uk',      'ur',      'vi',      'cy'
  ],
  userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0'
}

✔️ Generated language map
 {
  af: 'Afrikaans',
  sq: 'Albanian',
  am: 'Amharic',
  ar: 'Arabic',
  hy: 'Armenian',
  as: 'Assamese',
  az: 'Azerbaijani',
  bn: 'Bangla',
  ba: 'Bashkir',
  eu: 'Basque',
  bho: 'Bhojpuri',
  brx: 'Bodo',
  bs: 'Bosnian',
  bg: 'Bulgarian',
  yue: 'Cantonese (Traditional)',
  ca: 'Catalan',
  lzh: 'Chinese (Literary)',
  'zh-Hans': 'Chinese Simplified',
  'zh-Hant': 'Chinese Traditional',
  hr: 'Croatian',
  cs: 'Czech',
  da: 'Danish',
  prs: 'Dari',
  dv: 'Divehi',
  doi: 'Dogri',
  nl: 'Dutch',
  en: 'English',
  et: 'Estonian',
  fo: 'Faroese',
  fj: 'Fijian',
  fil: 'Filipino',
  fi: 'Finnish',
  fr: 'French',
  'fr-CA': 'French (Canada)',
  gl: 'Galician',
  lug: 'Ganda',
  ka: 'Georgian',
  de: 'German',
  el: 'Greek',
  gu: 'Gujarati',
  ht: 'Haitian Creole',
  ha: 'Hausa',
  he: 'Hebrew',
  hi: 'Hindi',
  mww: 'Hmong Daw',
  hu: 'Hungarian',
  is: 'Icelandic',
  ig: 'Igbo',
  id: 'Indonesian',
  ikt: 'Inuinnaqtun',
  iu: 'Inuktitut',
  'iu-Latn': 'Inuktitut (Latin)',
  ga: 'Irish',
  it: 'Italian',
  ja: 'Japanese',
  kn: 'Kannada',
  ks: 'Kashmiri',
  kk: 'Kazakh',
  km: 'Khmer',
  rw: 'Kinyarwanda',
  'tlh-Latn': 'Klingon (Latin)',
  gom: 'Konkani',
  ko: 'Korean',
  ku: 'Kurdish (Central)',
  kmr: 'Kurdish (Northern)',
  ky: 'Kyrgyz',
  lo: 'Lao',
  lv: 'Latvian',
  ln: 'Lingala',
  lt: 'Lithuanian',
  dsb: 'Lower Sorbian',
  mk: 'Macedonian',
  mai: 'Maithili',
  mg: 'Malagasy',
  ms: 'Malay',
  ml: 'Malayalam',
  mt: 'Maltese',
  mr: 'Marathi',
  'mn-Cyrl': 'Mongolian (Cyrillic)',
  'mn-Mong': 'Mongolian (Traditional)',
  my: 'Myanmar (Burmese)',
  mi: 'Māori',
  ne: 'Nepali',
  nb: 'Norwegian',
  nya: 'Nyanja',
  or: 'Odia',
  ps: 'Pashto',
  fa: 'Persian',
  pl: 'Polish',
  pt: 'Portuguese (Brazil)',
  'pt-PT': 'Portuguese (Portugal)',
  pa: 'Punjabi',
  otq: 'Querétaro Otomi',
  ro: 'Romanian',
  run: 'Rundi',
  ru: 'Russian',
  sm: 'Samoan',
  'sr-Cyrl': 'Serbian (Cyrillic)',
  'sr-Latn': 'Serbian (Latin)',
  st: 'Sesotho',
  nso: 'Sesotho sa Leboa',
  tn: 'Setswana',
  sn: 'Shona',
  sd: 'Sindhi',
  si: 'Sinhala',
  sk: 'Slovak',
  sl: 'Slovenian',
  so: 'Somali',
  es: 'Spanish',
  sw: 'Swahili',
  sv: 'Swedish',
  ty: 'Tahitian',
  ta: 'Tamil',
  tt: 'Tatar',
  te: 'Telugu',
  th: 'Thai',
  bo: 'Tibetan',
  ti: 'Tigrinya',
  to: 'Tongan',
  tr: 'Turkish',
  tk: 'Turkmen',
  uk: 'Ukrainian',
  hsb: 'Upper Sorbian',
  ur: 'Urdu',
  ug: 'Uyghur',
  uz: 'Uzbek (Latin)',
  vi: 'Vietnamese',
  cy: 'Welsh',
  xh: 'Xhosa',
  yo: 'Yoruba',
  yua: 'Yucatec Maya',
  zu: 'Zulu'
}

✔️ Generated dts from template

Test:

PS C:\Users\xxx\Downloads\bing-translate-api-master> npm run test

> bing-translate-api@3.0.0 test
> node test/index.js && node test/lang.js

Error: The supported maximum text length is 1000. Please shorten the text.
    at translate (C:\Users\xxx\Downloads\bing-translate-api-master\src\index.js:285:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Error: The supported maximum text length is 1000. Please shorten the text.
    at translate (C:\Users\xxx\Downloads\bing-translate-api-master\src\index.js:285:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Hello ----> 你好 fromLang en

The detected language 'en' is not supported to be corrected or the length of text is more than 50.
000000000000000000000000000000000000000000000000000 ----> undefined

00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ----> Zero fromLang en

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ----> Zero fromLang en

Hello ----> გამარჯობა fromLang en

你好 ----> Hello fromLang zh-Hans

The detected language 'hr' is not supported to be corrected or the length of text is more than 50.
Bore da ----> undefined

this text is vry lang ----> this text is very long

안녕하십니까 ----> 你好 fromLang ko

gradent ----> gradient

邹忌修八尺有余,而形貌昳丽。朝服衣冠,窥镜,谓其妻曰:“我孰与城北徐公美?”。其妻曰:“君美甚,徐公何能及君也?” ----> 邹 忌身高八尺多,而且外形、容貌光艳美丽。穿着官服,照镜子,对妻子说:“我和城北徐公比,谁更美?”他的妻子说:“您非常美丽,徐 公怎么能比得上您?” fromLang zh-Hant

en supported: true
en1 supported: false
Korean language code: ko

@MahmutHizal MahmutHizal changed the title Maksimum text lenght is 1000 Maximum text lenght is 1000 Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants