[Kimchi-devel] [PATCH] Install kimchi.mo files in the default locale dir

Daniel H Barboza danielhb at linux.vnet.ibm.com
Fri Aug 1 16:58:15 UTC 2014


Reviewed-by: Daniel Barboza <danielhb at linux.vnet.ibm.com>
Tested-by: Daniel Barboza <danielhb at linux.vnet.ibm.com>

To properly test this contribution I had to clean the browser cache / 
run in private mode. The steps I've made:

$ make clean
$ ./autogen.sh --system
$ make
$ PYTHONPATH=src python src/kimchid

And run in private mode (SHIFT+CTRL+N in Chrome)

thanks


On 07/31/2014 11:10 PM, Aline Manera wrote:
> By default, all translation files (.mo files) are installed in
> %{_prefix}/share/locale
>
> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
> ---
>   contrib/kimchi.spec.fedora.in    | 2 +-
>   contrib/kimchi.spec.suse.in      | 2 +-
>   plugins/sample/po/Makefile.in.in | 2 +-
>   po/Makefile.in.in                | 2 +-
>   src/kimchi/config.py.in          | 6 +++++-
>   tests/Makefile.am                | 1 +
>   tests/test_config.py.in          | 2 +-
>   7 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
> index ca3f7e1..c153086 100644
> --- a/contrib/kimchi.spec.fedora.in
> +++ b/contrib/kimchi.spec.fedora.in
> @@ -160,7 +160,7 @@ rm -rf $RPM_BUILD_ROOT
>   %{_datadir}/kimchi/doc/README.md
>   %{_datadir}/kimchi/doc/kimchi-guest.png
>   %{_datadir}/kimchi/doc/kimchi-templates.png
> -%{_datadir}/kimchi/mo/*/LC_MESSAGES/kimchi.mo
> +%{_prefix}/share/locale/*/LC_MESSAGES/kimchi.mo
>   %{_datadir}/kimchi/config/ui/*.xml
>   %if %{with_fonts} == 1
>   %{_datadir}/kimchi/ui/css/fonts/novnc/Orbitron700.*
> diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
> index 73304c2..1c81770 100644
> --- a/contrib/kimchi.spec.suse.in
> +++ b/contrib/kimchi.spec.suse.in
> @@ -81,7 +81,7 @@ rm -rf $RPM_BUILD_ROOT
>   %{_datadir}/kimchi/doc/README.md
>   %{_datadir}/kimchi/doc/kimchi-guest.png
>   %{_datadir}/kimchi/doc/kimchi-templates.png
> -%{_datadir}/kimchi/mo/*/LC_MESSAGES/kimchi.mo
> +%{_prefix}/share/locale/*/LC_MESSAGES/kimchi.mo
>   %{_datadir}/kimchi/config/ui/*.xml
>   %if %{with_fonts} == 1
>   %{_datadir}/kimchi/ui/css/fonts/novnc/Orbitron700.*
> diff --git a/plugins/sample/po/Makefile.in.in b/plugins/sample/po/Makefile.in.in
> index 0eb3dda..52ab81c 100644
> --- a/plugins/sample/po/Makefile.in.in
> +++ b/plugins/sample/po/Makefile.in.in
> @@ -26,7 +26,7 @@ prefix = @prefix@
>   exec_prefix = @exec_prefix@
>   datarootdir = @datarootdir@
>   datadir = @datadir@
> -localedir = @datadir@/kimchi/mo
> +localedir = @prefix@/share/locale
>   gettextsrcdir = $(datadir)/gettext/po
>
>   INSTALL = @INSTALL@
> diff --git a/po/Makefile.in.in b/po/Makefile.in.in
> index 239e4e5..d01fb31 100644
> --- a/po/Makefile.in.in
> +++ b/po/Makefile.in.in
> @@ -26,7 +26,7 @@ prefix = @prefix@
>   exec_prefix = @exec_prefix@
>   datarootdir = @datarootdir@
>   datadir = @datadir@
> -localedir = @datadir@/kimchi/mo
> +localedir = @prefix@/share/locale
>   gettextsrcdir = $(datadir)/gettext/po
>
>   INSTALL = @INSTALL@
> diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in
> index 3aef8cf..e18159c 100644
> --- a/src/kimchi/config.py.in
> +++ b/src/kimchi/config.py.in
> @@ -102,7 +102,11 @@ class Paths(object):
>               self.plugins_dir = self.add_prefix('plugins')
>
>           self.ui_dir = self.add_prefix('ui')
> -        self.mo_dir = self.add_prefix('mo')
> +
> +        if self.installed:
> +            self.mo_dir = '@prefix@/share/locale'
> +        else:
> +            self.mo_dir = self.add_prefix('mo')
>
>       def get_prefix(self):
>           if __file__.startswith("/"):
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index e89a572..7f5294e 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -28,6 +28,7 @@ noinst_SCRIPTS = run_tests.sh
>
>   do_substitution = \
>   	sed -e 's,[@]HAVE_PYMOD_UNITTEST[@],$(HAVE_PYMOD_UNITTEST),g' \
> +	-e 's,[@]prefix[@],$(prefix),g' \
>   	-e 's,[@]PYTHON_VERSION[@],$(PYTHON_VERSION),g' \
>   	-e 's,[@]kimchidir[@],$(pythondir)/kimchi,g' \
>   	-e 's,[@]pkgdatadir[@],$(pkgdatadir),g'
> diff --git a/tests/test_config.py.in b/tests/test_config.py.in
> index f349419..75ffdd7 100644
> --- a/tests/test_config.py.in
> +++ b/tests/test_config.py.in
> @@ -51,7 +51,7 @@ class ConfigTests(unittest.TestCase):
>           self.assertInstalledPath(paths.src_dir, '@kimchidir@')
>           self.assertInstalledPath(paths.plugins_dir, '@kimchidir@/plugins')
>           self.assertInstalledPath(paths.ui_dir, '@pkgdatadir@/ui')
> -        self.assertInstalledPath(paths.mo_dir, '@pkgdatadir@/mo')
> +        self.assertInstalledPath(paths.mo_dir, '@prefix@/share/locale')
>
>       def test_uninstalled_paths(self):
>           Paths.get_prefix = lambda self: '/home/user/kimchi'




More information about the Kimchi-devel mailing list