summaryrefslogtreecommitdiff
path: root/beos
diff options
context:
space:
mode:
authorFran├žois Revol <revol@free.fr>2013-12-30 16:18:53 +0100
committerFran├žois Revol <revol@free.fr>2014-01-04 19:43:52 +0100
commit6f4e293311faa6bf485d40eb15f684b6559241a1 (patch)
tree7d438264498e2f95836372043d4abdabd658ae09 /beos
parentd69997c8a323bb593f642830b28ed0c4d7de476c (diff)
downloadnetsurf-6f4e293311faa6bf485d40eb15f684b6559241a1.tar.gz
netsurf-6f4e293311faa6bf485d40eb15f684b6559241a1.tar.bz2
beos: Load Messages files for current language
For now we just check for LC_MESSAGES in the environment, which should even work in BeOS. Someday we should probably use Haiku's BLocale API instead.
Diffstat (limited to 'beos')
-rw-r--r--beos/gui.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 131173c64..7c8418215 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -512,6 +512,20 @@ static bool nslog_stream_configure(FILE *fptr)
return true;
}
+static BPath get_messages_path()
+{
+ BPath p("/boot/apps/netsurf/res");
+ // TODO: use Haiku's BLocale stuff
+ BString lang(getenv("LC_MESSAGES"));
+ lang.Truncate(2);
+ BDirectory d(p.Path());
+ if (!d.Contains(lang.String(), B_DIRECTORY_NODE))
+ lang = "en";
+ p.Append(lang.String());
+ p.Append("Messages");
+ return p;
+}
+
/** Normal entry point from OS */
int main(int argc, char** argv)
{
@@ -527,8 +541,6 @@ int main(int argc, char** argv)
new NSBrowserApplication;
}
- const char* messages = "/boot/apps/netsurf/res/en/Messages";
-
/* initialise logging. Not fatal if it fails but not much we
* can do about it either.
*/
@@ -543,7 +555,8 @@ int main(int argc, char** argv)
nsoption_commandline(&argc, argv, NULL);
/* common initialisation */
- ret = netsurf_init(messages);
+ BPath messages = get_messages_path();
+ ret = netsurf_init(messages.Path());
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
}
@@ -567,8 +580,6 @@ int gui_init_replicant(int argc, char** argv)
options.Append("x-vnd.NetSurf");
}
- const char* messages = "/boot/apps/netsurf/res/en/Messages";
-
/* initialise logging. Not fatal if it fails but not much we
* can do about it either.
*/
@@ -585,7 +596,8 @@ int gui_init_replicant(int argc, char** argv)
nsoption_commandline(&argc, argv, NULL);
/* common initialisation */
- ret = netsurf_init(messages);
+ BPath messages = get_messages_path();
+ ret = netsurf_init(messages.Path());
if (ret != NSERROR_OK) {
// FIXME: must not die when in replicant!
die("NetSurf failed to initialise");