mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							4093c98794
						
					
				
				
					commit
					ca3be1f336
				
			| @@ -541,7 +541,10 @@ | ||||
| 			} | ||||
|  | ||||
| 			if (!(typeof text === 'string' || text instanceof String) || text === '') { | ||||
| 				return cb(''); | ||||
| 				if (cb) { | ||||
| 					return setTimeout(cb, 0, ''); | ||||
| 				} | ||||
| 				return ''; | ||||
| 			} | ||||
|  | ||||
| 			return Translator.create(lang).translate(text).then(function (output) { | ||||
|   | ||||
| @@ -21,6 +21,18 @@ describe('Translator shim', function () { | ||||
| 				done(); | ||||
| 			}); | ||||
| 		}); | ||||
|  | ||||
| 		it('should translate empty string properly', function (done) { | ||||
| 			shim.translate('', 'en-GB', function (translated) { | ||||
| 				assert.strictEqual(translated, ''); | ||||
| 				done(); | ||||
| 			}); | ||||
| 		}); | ||||
|  | ||||
| 		it('should translate empty string properly', async function () { | ||||
| 			const translated = await shim.translate('', 'en-GB'); | ||||
| 			assert.strictEqual(translated, ''); | ||||
| 		}); | ||||
| 	}); | ||||
| }); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user