hgettext 0.1.40.1 → 0.1.40.2
raw patch · 3 files changed
+42/−15 lines, 3 filesdep ~Cabaldep ~basedep ~extranew-uploader
Dependency ranges changed: Cabal, base, extra, filepath
Files
- CHANGELOG.md +9/−1
- hgettext.cabal +18/−14
- src/Text/I18N/GetText.hs +15/−0
CHANGELOG.md view
@@ -1,4 +1,12 @@-### 0.1.40.1+## 0.1.40.2++_Nikola Hadžić, 2025-01-13_++- Library binding for [`bind_textdomain_codeset`](https://man.archlinux.org/man/core/gettext/bind_textdomain_codeset.3.en) function ([#26](https://github.com/haskell-hvr/hgettext/pull/26), contribution by Rafał Kuźnia)++Tested with GHC 8.0.2 - 9.10.1.++## 0.1.40.1 _Andreas Abel, 2022-09-19_
hgettext.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.14 name: hgettext-version: 0.1.40.1+version: 0.1.40.2 build-type: Simple license: BSD3@@ -19,8 +19,11 @@ A user-contributed tutorial can be found in the [Haskell Wiki](https://wiki.haskell.org/Internationalization_of_Haskell_programs_using_gettext). tested-with:- GHC == 9.4.2- GHC == 9.2.4+ GHC == 9.10.1+ GHC == 9.8.4+ GHC == 9.6.6+ GHC == 9.4.8+ GHC == 9.2.8 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4@@ -28,10 +31,11 @@ GHC == 8.4.4 GHC == 8.2.2 GHC == 8.0.2- GHC == 7.10.3- GHC == 7.8.4- GHC == 7.6.3- GHC == 7.4.2+ -- Drop testing GHC 7+ -- GHC == 7.10.3+ -- GHC == 7.8.4+ -- GHC == 7.6.3+ -- GHC == 7.4.2 extra-source-files: CHANGELOG.md@@ -47,11 +51,11 @@ other-modules: Internal hs-source-dirs: src- build-depends: base >=4.5 && <4.18- , Cabal >=1.14 && <1.25 || >= 2.0 && < 2.5 || >=3.0 && <3.9- , containers >=0.4.2 && <0.7+ build-depends: base >=4.5 && <4.22+ , Cabal >=1.14 && <1.25 || >= 2.0 && < 2.5 || >=3.0 && <3.15+ , containers >=0.4.2 && <0.8 , directory >=1.1 && <1.4- , filepath >=1.3 && <1.5+ , filepath >=1.3 && <1.6 , process >=1.1 && <1.7 , setlocale >=0.0.3 && <1.1 @@ -76,12 +80,12 @@ , containers , filepath - build-depends: deepseq >=1.1 && <1.5+ build-depends: deepseq >=1.1 && <1.6 , cpphs >=1.20.9.1 && <1.20.10 , haskell-src-exts >=1.18 && <1.24 , uniplate >=1.6.12 && <1.7- , split >=0.2.3.4 && <0.2.4- , extra >=0.1 && <1.8+ , split >=0.2.3.4 && <0.3+ , extra >=0.1 && <1.9 -- readFileUTF8 exists since extra-0.1 ghc-options: -Wall
src/Text/I18N/GetText.hs view
@@ -8,6 +8,7 @@ dcGetText, dcnGetText, bindTextDomain,+ bindTextDomainCodeset, textDomain ) where @@ -43,6 +44,9 @@ foreign import ccall unsafe "libintl.h textdomain" c_textdomain :: CString -> IO CString +foreign import ccall unsafe "libintl.h bind_textdomain_codeset" c_bind_textdomain_codeset+ :: CString -> CString -> IO CString+ fromCString :: CString -> IO (Maybe String) fromCString x | x == nullPtr = return Nothing | otherwise = peekCString x >>= return . Just@@ -184,3 +188,14 @@ textDomain domainname = withCStringMaybe domainname $ \domain -> c_textdomain domain >>= fromCStringError "textDomain fails"++-- | 'bindTextDomainCodeset' sets domain codeset for future 'getText' call+--+bindTextDomainCodeset :: String -- ^ domain name+ -> Maybe String -- ^ locale codeset or 'Nothing' to return+ -- the active codeset for the given domain+ -> IO (Maybe String) -- ^ return value+bindTextDomainCodeset domainname dirname =+ withCString domainname $ \domain ->+ withCStringMaybe dirname $ \dir ->+ c_bind_textdomain_codeset domain dir >>= fromCString