Rebuild PO files.
[virt-p2v.git] / virt-p2v
index 4e2d9dd..b257bc4 100755 (executable)
--- a/virt-p2v
+++ b/virt-p2v
@@ -144,6 +144,20 @@ module P2VGettext = Gettext.Program (
 ) (GettextStub.Native)
 open P2VGettext
 
+let supported_langs =
+  (* Note these strings are NOT translated! *)
+  let nonasian_langs = [
+    "English", "en_US.UTF-8";
+  ] in
+  let asian_langs = [
+    "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (Japanese)", "ja_JP.UTF-8"
+  ] in
+  (* Linux console doesn't support Asian or RTL languages. *)
+  let term = try getenv "TERM" with Not_found -> "" in
+  match term with
+  | "linux" -> nonasian_langs
+  | _       -> nonasian_langs @ asian_langs
+
 (*----------------------------------------------------------------------*)
 (* General helper functions. *)
 
@@ -700,7 +714,7 @@ let test_ssh config =
     true
 
 (* Rewrite /mnt/root/etc/fstab. *)
-let rewrite_fstab devices_to_send =
+let rewrite_fstab () =
   let filename = "/mnt/root/etc/fstab" in
   if is_file filename = Some true then (
     sh ("cp " ^ quote filename ^ " " ^ quote (filename ^ ".p2vsaved"));
@@ -823,18 +837,12 @@ let rec main ttyname =
   );
 
   (* Choose language early, so messages are translated. *)
-  if !config_greeting then (
+  if !config_greeting && List.length supported_langs > 1 then (
     with_newt (
       fun () ->
-       (* Note these strings are NOT translated! *)
-       let items = [
-         "English", "en_US.UTF-8";
-         "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (Japanese)", "ja_JP.UTF-8"
-       ] in
-
        let lang = select_single ~stage:(s_ "Select language") 40
          (s_ "Select language")
-         items in
+         supported_langs in
 
        putenv "LANG" lang;
        ignore (GettextStubCompat.setlocale GettextStubCompat.LC_ALL lang)
@@ -1676,7 +1684,7 @@ let rec main ttyname =
   ) config_devices_to_send in
 
   (* Modify files on the root filesystem. *)
-  rewrite_fstab config_devices_to_send;
+  rewrite_fstab ();
   (* XXX Other files to rewrite? *)
 
   (* Unmount the root filesystem and sync disks. *)