Op 27-5-2013 18:05, Jean-Marc Lasgouttes schreef:
24/05/2013 15:07, Vincent van Ravesteijn:
By the way, this doesn't always work. The kill-gettext branch, for
instance, has master merged in a few times to fix merge conflicts. Now,
rebasing onto the merge-base does do no good.

Vincent, I want to merge this kill-gettext branch now. Is there something I should do to make it less ugly? I do not understand why it requires such ugly merges in the middle. What about good old hand-made conflict resolution?

Anyway, if you tell me to merge it as it is, it will be fine with me.

JMarc

I tested the branch a bit more.

- When you just implemented this, my LyX was translated immediately, but now it can't find the translations anymore. This is a pity.

I don't really understand the following:

+ if (in_build_dir_)
+        return FileName(top_srcdir().absFileName() + "/po/"
+                + c + ".gmo");

So, if we run in the build dir, we look for the gmo files in the source dir ? Shouldn't we be looking the build dir then ? What about the attached ?

- I get an error that the language C could not be found. I know this is logical when the po-files can't be found, but it is a bit confusing that the language is "C".

Vincent
>From 412f013cdd7f1c70e631022d5ab4489ce60c216b Mon Sep 17 00:00:00 2001
From: Vincent van Ravesteijn <v...@lyx.org>
Date: Mon, 27 May 2013 21:43:50 +0200
Subject: [PATCH] Look for locale dir in the build directory

---
 src/support/Package.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/support/Package.cpp b/src/support/Package.cpp
index 24cf8ca..725999a 100644
--- a/src/support/Package.cpp
+++ b/src/support/Package.cpp
@@ -83,7 +83,8 @@ FileName findLyxBinary(FileName const & abs_binary);
 
 FileName const get_document_dir(FileName const & home_dir);
 
-FileName const get_locale_dir(FileName const & system_support_dir);
+FileName const get_locale_dir(FileName const & system_support_dir,
+       FileName const & build_support_dir);
 
 FileName const get_system_support_dir(FileName const & abs_binary,
                                    string const & 
command_line_system_support_dir);
@@ -130,7 +131,7 @@ Package::Package(string const & command_line_arg0,
        // Find the LyX executable
        lyx_binary_ = findLyxBinary(abs_binary);
 
-       locale_dir_ = get_locale_dir(system_support_dir_);
+       locale_dir_ = get_locale_dir(system_support_dir_, build_support_dir_);
 
        FileName const default_user_support_dir =
                get_default_user_support_dir(get_home_dir());
@@ -168,8 +169,7 @@ void Package::set_temp_dir(FileName const & temp_dir) const
 FileName Package::messages_file(string const & c) const
 {
        if (in_build_dir_)
-               return FileName(top_srcdir().absFileName() + "/po/"
-                               + c + ".gmo");
+               return FileName(locale_dir_.absFileName() + "/" + c + ".gmo");
        else
                return FileName(locale_dir_.absFileName() + "/" + c
                        + "/LC_MESSAGES/" PACKAGE ".mo");
@@ -408,7 +408,8 @@ FileName const get_document_dir(FileName const & home_dir)
 
 // Several sources are probed to ascertain the locale directory.
 // The only requirement is that the result is indeed a directory.
-FileName const get_locale_dir(FileName const & system_support_dir)
+FileName const get_locale_dir(FileName const & system_support_dir,
+       FileName const & build_support_dir)
 {
        // 1. Use the "LYX_LOCALEDIR" environment variable.
        FileName const path_env = extract_env_var_dir("LYX_LOCALEDIR");
@@ -424,7 +425,12 @@ FileName const get_locale_dir(FileName const & 
system_support_dir)
        if (path.exists() && path.isDirectory())
                return path;
 
-       // 3. Fall back to the hard-coded LOCALEDIR.
+       // 3. Search for build_support_dir/../po
+       path = FileName(addPath(build_support_dir.absFileName(), "../po"));
+       if (path.exists() && path.isDirectory())
+               return path;
+
+       // 4. Fall back to the hard-coded LOCALEDIR.
        path = hardcoded_localedir();
        if (path.exists() && path.isDirectory())
                return path;
-- 
1.8.0.msysgit.0

Reply via email to