blob: 635ed5817d3e1054c26015ffe58a569a7e605088 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
/***************************************************************************
language.cpp
Multi-language support.
***************************************************************************/
#include "emu.h"
#include "language.h"
#include "emuopts.h"
#include "fileio.h"
#include "corestr.h"
#include <string>
void load_translation(emu_options &m_options)
{
util::unload_translation();
std::string name = m_options.language();
if (name.empty())
return;
strreplace(name, " ", "_");
strreplace(name, "(", "");
strreplace(name, ")", "");
// MESSUI: See if language file exists. If not, try English, see if that exists. If not, use inbuilt default.
emu_file file(m_options.language_path(), OPEN_FLAG_READ);
if (file.open(name + PATH_SEPARATOR "strings.mo"))
{
osd_printf_verbose("Error opening translation file %s\n", name);
name = "English";
if (file.open(name + PATH_SEPARATOR "strings.mo"))
{
osd_printf_verbose("Error opening translation file %s\n", name);
return;
}
}
osd_printf_verbose("Loading translation file %s\n", file.fullpath());
util::load_translation(file);
}
|