mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	No more C source files, no more necessity to use C-linkage. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
		
			
				
	
	
		
			17 lines
		
	
	
	
		
			434 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
	
		
			434 B
		
	
	
	
		
			C++
		
	
	
	
	
	
// SPDX-License-Identifier: GPL-2.0
 | 
						|
#include "gettextfromc.h"
 | 
						|
#include <QHash>
 | 
						|
#include <QMutex>
 | 
						|
 | 
						|
static QHash<QByteArray, QByteArray> translationCache;
 | 
						|
static QMutex lock;
 | 
						|
 | 
						|
const char *trGettext(const char *text)
 | 
						|
{
 | 
						|
	QByteArray key(text);
 | 
						|
	QMutexLocker l(&lock);
 | 
						|
	auto it = translationCache.find(key);
 | 
						|
	if (it == translationCache.end())
 | 
						|
		it = translationCache.insert(key, gettextFromC::tr(text).toUtf8());
 | 
						|
	return it->constData();
 | 
						|
}
 |