mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-03-31 09:17:04 +09:00
Add Russian and Ukrainian translation and create translation template.
- Introduced a new translation template file for GPU Screen Recorder UI. - Improved some translation methods
This commit is contained in:
@@ -9,8 +9,12 @@ namespace gsr {
|
||||
static Translation& instance();
|
||||
void init(const char* translations_directory, const char* initial_language = nullptr);
|
||||
bool load_language(const char* lang);
|
||||
bool is_language_supported(const char* lang);
|
||||
bool plural_numbers_are_complex();
|
||||
const char* translate(const char* key);
|
||||
|
||||
std::string get_complex_plural_number_key(const char* key, int number);
|
||||
|
||||
template<typename... Args>
|
||||
std::string format(const char* key, Args&&... args) {
|
||||
const char* fmt = translate(key);
|
||||
@@ -24,6 +28,7 @@ namespace gsr {
|
||||
private:
|
||||
std::string get_system_language();
|
||||
std::string trim(const std::string& str);
|
||||
void process_escapes(std::string& str);
|
||||
|
||||
private:
|
||||
std::string translations_directory;
|
||||
@@ -33,4 +38,6 @@ namespace gsr {
|
||||
}
|
||||
|
||||
#define TR(s) gsr::Translation::instance().translate(s)
|
||||
#define TRF(s, ...) gsr::Translation::instance().format(s, __VA_ARGS__)
|
||||
#define TRF(s, ...) gsr::Translation::instance().format(s, __VA_ARGS__)
|
||||
#define TRC(s, n) gsr::Translation::instance().get_complex_plural_number_key(s, n)
|
||||
#define TRPF(s, n, ...) TRF(TRC(s, n).c_str(), __VA_ARGS__)
|
||||
Reference in New Issue
Block a user