fix(all): Translator and spelling.
This commit is contained in:
		
							parent
							
								
									9c8fff3629
								
							
						
					
					
						commit
						6bad713630
					
				
					 2 changed files with 13 additions and 7 deletions
				
			
		
							
								
								
									
										2
									
								
								.wwebjs_cache/2.2407.2.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.wwebjs_cache/2.2407.2.html
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
				
			
			@ -960,28 +960,30 @@ export class GBConversationalService {
 | 
			
		|||
        return Promise.reject(new Error(msg));
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      const url = urlJoin(
 | 
			
		||||
      let url = urlJoin(
 | 
			
		||||
        endPoint,
 | 
			
		||||
        'translate',
 | 
			
		||||
        'translate');
 | 
			
		||||
      url += "?" +
 | 
			
		||||
        new URLSearchParams({
 | 
			
		||||
          'api-version': '3.0',
 | 
			
		||||
          to: language
 | 
			
		||||
        }).toString()
 | 
			
		||||
      );
 | 
			
		||||
      
 | 
			
		||||
      let options = {
 | 
			
		||||
        method: 'POST',
 | 
			
		||||
        headers: {
 | 
			
		||||
          'Ocp-Apim-Subscription-Key': key,
 | 
			
		||||
          'Ocp-Apim-Subscription-Region': 'westeurope',
 | 
			
		||||
          'Ocp-Apim-Subscription-Region': process.env.TRANSLATOR_REGION,
 | 
			
		||||
          'Content-type': 'application/json',
 | 
			
		||||
          'X-ClientTraceId': GBAdminService.generateUuid()
 | 
			
		||||
        },
 | 
			
		||||
        body: text,
 | 
			
		||||
        json: true
 | 
			
		||||
        body: `[{'Text':'${text}'}]`,
 | 
			
		||||
        json: false
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      try {
 | 
			
		||||
        const results = await fetch(url, options);
 | 
			
		||||
        let results = await fetch(url, options);
 | 
			
		||||
        results = await results.json();
 | 
			
		||||
 | 
			
		||||
        return results[0].translations[0].text;
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1084,6 +1086,8 @@ export class GBConversationalService {
 | 
			
		|||
    if (text != '' && detectLanguage && !locale) {
 | 
			
		||||
      locale = await min.conversationalService.getLanguage(min, text);
 | 
			
		||||
      if (user.locale != locale) {
 | 
			
		||||
 | 
			
		||||
        GBLog.info(`Changed language to: ${locale}`);
 | 
			
		||||
        user = await sec.updateUserLocale(user.userId, locale);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue