diff options
author | Will Thompson <will@willthompson.co.uk> | 2017-07-20 11:26:06 +0100 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2017-07-20 16:56:33 +0100 |
commit | 1c96472ba19900e5a4a52f08593144baa0daaaf1 (patch) | |
tree | 5178be08eddf81f15cb24427070615ddc1dcdfee | |
parent | e3731c47b88ef6930b635a40a20298089cd1238d (diff) |
Add a flag to enable/disable translations
hgettext transitively depends on old-time which doesn't build against
Haskell Platform 8.0.2's base. I can't muster much enthusiasm for
fixing this when there are no translations, so I'll just disable it in
the Flatpak.
-rw-r--r-- | Bustle/Translation.hs | 11 | ||||
-rw-r--r-- | bustle.cabal | 17 |
2 files changed, 20 insertions, 8 deletions
diff --git a/Bustle/Translation.hs b/Bustle/Translation.hs index dadc6e6..3fecef7 100644 --- a/Bustle/Translation.hs +++ b/Bustle/Translation.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} module Bustle.Translation ( initTranslation @@ -5,13 +6,18 @@ module Bustle.Translation ) where +#ifdef USE_HGETTEXT import Text.I18N.GetText import System.Locale.SetLocale import System.IO.Unsafe import GetText_bustle +#endif initTranslation :: IO () +__ :: String -> String + +#ifdef USE_HGETTEXT initTranslation = do setLocale LC_ALL (Just "") domain <- getMessageCatalogDomain @@ -21,5 +27,8 @@ initTranslation = do return () -- FIXME: I do not like this unsafePerformIO one little bit. -__ :: String -> String __ = unsafePerformIO . getText +#else +initTranslation = return () +__ = id +#endif
\ No newline at end of file diff --git a/bustle.cabal b/bustle.cabal index 5a7e944..92732e9 100644 --- a/bustle.cabal +++ b/bustle.cabal @@ -64,6 +64,10 @@ Source-Repository head Type: git Location: git://anongit.freedesktop.org/bustle +Flag hgettext + Description: Enable translations. Since there are no translations this is currently rather pointless. + Default: True + Flag InteractiveTests Description: Build interactive test programs Default: False @@ -115,14 +119,16 @@ Executable bustle , glib , gio , gtk3 - , hgettext >= 0.1.5 , mtl >= 2.2.1 , pango , pcap , process - , setlocale , text , time + if flag(hgettext) + Build-Depends: hgettext >= 0.1.5 + , setlocale + cpp-options: -DUSE_HGETTEXT Executable test-monitor if flag(InteractiveTests) @@ -148,13 +154,12 @@ Executable test-monitor -- 0.13.6 doesn't compile with GCC 5: https://github.com/gtk2hs/gtk2hs/issues/104 , gtk3 >= 0.13.7 , glib - , hgettext , mtl , pango , pcap - , setlocale , text + Executable dump-messages if flag(InteractiveTests) buildable: True @@ -207,8 +212,6 @@ Test-suite test-renderer , mtl , text , pango - , hgettext - , setlocale , test-framework , test-framework-hunit - , HUnit + , HUnit
\ No newline at end of file |