2004-08-21 13:45:01 +02:00
|
|
|
/*
|
|
|
|
|
|
|
|
The only file that external code should need to include.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#ifndef INCLUDED_I18N_INTERFACE
|
|
|
|
#define INCLUDED_I18N_INTERFACE
|
2004-08-21 13:45:01 +02:00
|
|
|
|
|
|
|
#include "StringBuffer.h"
|
|
|
|
#include "DataTypes.h"
|
|
|
|
|
|
|
|
struct JSContext;
|
2004-09-01 21:48:03 +02:00
|
|
|
struct JSObject;
|
2004-08-21 13:45:01 +02:00
|
|
|
|
|
|
|
namespace I18n
|
|
|
|
{
|
|
|
|
// Use an interface class, so minimal headers are required by
|
|
|
|
// anybody who only wants to make use of Translate()
|
|
|
|
class CLocale_interface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual StringBuffer Translate(const wchar_t* id) = 0;
|
|
|
|
|
|
|
|
// Load* functions return true for success, false for failure
|
|
|
|
|
|
|
|
// Pass the contents of a UTF-16LE BOMmed .js file.
|
|
|
|
// The filename is just used to give more useful error messages from JS.
|
|
|
|
virtual bool LoadFunctions(const char* filedata, size_t len, const char* filename) = 0;
|
|
|
|
|
|
|
|
// Desires a .lng file, as produced by convert.pl
|
|
|
|
virtual bool LoadStrings(const char* filedata) = 0;
|
|
|
|
|
|
|
|
// Needs .wrd files generated through tables.pl
|
2004-08-24 13:28:18 +02:00
|
|
|
virtual bool LoadDictionary(const char* filedata) = 0;
|
2004-08-21 13:45:01 +02:00
|
|
|
|
2004-09-17 19:45:44 +02:00
|
|
|
virtual void UnloadDictionaries() = 0;
|
|
|
|
|
2004-08-21 13:45:01 +02:00
|
|
|
virtual ~CLocale_interface() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Build a CLocale. Returns NULL on failure.
|
2004-09-01 21:48:03 +02:00
|
|
|
CLocale_interface* NewLocale(JSContext* cx, JSObject* scope);
|
2004-08-21 13:45:01 +02:00
|
|
|
}
|
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#endif // INCLUDED_I18N_INTERFACE
|