{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The t'GI.Pango.Structs.Language.Language' structure is used to
-- represent a language.
-- 
-- t'GI.Pango.Structs.Language.Language' pointers can be efficiently
-- copied and compared with each other.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Pango.Structs.Language
    ( 

-- * Exported types
    Language(..)                            ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveLanguageMethod                   ,
#endif


-- ** fromString #method:fromString#

    languageFromString                      ,


-- ** getDefault #method:getDefault#

    languageGetDefault                      ,


-- ** getSampleString #method:getSampleString#

#if defined(ENABLE_OVERLOADING)
    LanguageGetSampleStringMethodInfo       ,
#endif
    languageGetSampleString                 ,


-- ** includesScript #method:includesScript#

#if defined(ENABLE_OVERLOADING)
    LanguageIncludesScriptMethodInfo        ,
#endif
    languageIncludesScript                  ,


-- ** matches #method:matches#

#if defined(ENABLE_OVERLOADING)
    LanguageMatchesMethodInfo               ,
#endif
    languageMatches                         ,


-- ** toString #method:toString#

#if defined(ENABLE_OVERLOADING)
    LanguageToStringMethodInfo              ,
#endif
    languageToString                        ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import {-# SOURCE #-} qualified GI.Pango.Enums as Pango.Enums

-- | Memory-managed wrapper type.
newtype Language = Language (SP.ManagedPtr Language)
    deriving (Language -> Language -> Bool
(Language -> Language -> Bool)
-> (Language -> Language -> Bool) -> Eq Language
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Language -> Language -> Bool
$c/= :: Language -> Language -> Bool
== :: Language -> Language -> Bool
$c== :: Language -> Language -> Bool
Eq)

instance SP.ManagedPtrNewtype Language where
    toManagedPtr :: Language -> ManagedPtr Language
toManagedPtr (Language ManagedPtr Language
p) = ManagedPtr Language
p

foreign import ccall "pango_language_get_type" c_pango_language_get_type :: 
    IO GType

type instance O.ParentTypes Language = '[]
instance O.HasParentTypes Language

instance B.Types.TypedObject Language where
    glibType :: IO GType
glibType = IO GType
c_pango_language_get_type

instance B.Types.GBoxed Language

-- | Convert 'Language' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue Language where
    toGValue :: Language -> IO GValue
toGValue Language
o = do
        GType
gtype <- IO GType
c_pango_language_get_type
        Language -> (Ptr Language -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Language
o (GType
-> (GValue -> Ptr Language -> IO ()) -> Ptr Language -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Language -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
        
    fromGValue :: GValue -> IO Language
fromGValue GValue
gv = do
        Ptr Language
ptr <- GValue -> IO (Ptr Language)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr Language)
        (ManagedPtr Language -> Language) -> Ptr Language -> IO Language
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Language -> Language
Language Ptr Language
ptr
        
    


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Language
type instance O.AttributeList Language = LanguageAttributeList
type LanguageAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method Language::get_sample_string
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Language" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoLanguage, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "pango_language_get_sample_string" pango_language_get_sample_string :: 
    Ptr Language ->                         -- language : TInterface (Name {namespace = "Pango", name = "Language"})
    IO CString

-- | Get a string that is representative of the characters needed to
-- render a particular language.
-- 
-- The sample text may be a pangram, but is not necessarily.  It is chosen to
-- be demonstrative of normal text in the language, as well as exposing font
-- feature requirements unique to the language.  It is suitable for use
-- as sample text in a font selection dialog.
-- 
-- If /@language@/ is 'P.Nothing', the default language as found by
-- 'GI.Pango.Functions.languageGetDefault' is used.
-- 
-- If Pango does not have a sample string for /@language@/, the classic
-- \"The quick brown fox...\" is returned.  This can be detected by
-- comparing the returned pointer value to that returned for (non-existent)
-- language code \"xx\".  That is, compare to:
-- \<informalexample>\<programlisting>
-- pango_language_get_sample_string (pango_language_from_string (\"xx\"))
-- \<\/programlisting>\<\/informalexample>
languageGetSampleString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Language
    -- ^ /@language@/: a t'GI.Pango.Structs.Language.Language', or 'P.Nothing'
    -> m T.Text
    -- ^ __Returns:__ the sample string. This value is owned by Pango
    --   and should not be freed.
languageGetSampleString :: Language -> m Text
languageGetSampleString Language
language = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Language
language' <- Language -> IO (Ptr Language)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Language
language
    CString
result <- Ptr Language -> IO CString
pango_language_get_sample_string Ptr Language
language'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"languageGetSampleString" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Language -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Language
language
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data LanguageGetSampleStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo LanguageGetSampleStringMethodInfo Language signature where
    overloadedMethod = languageGetSampleString

#endif

-- XXX Could not generate method Language::get_scripts
-- Not implemented: Don't know how to allocate "num_scripts" of type TBasicType TInt
-- method Language::includes_script
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Language" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoLanguage, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "script"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Script" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoScript" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_language_includes_script" pango_language_includes_script :: 
    Ptr Language ->                         -- language : TInterface (Name {namespace = "Pango", name = "Language"})
    CInt ->                                 -- script : TInterface (Name {namespace = "Pango", name = "Script"})
    IO CInt

-- | Determines if /@script@/ is one of the scripts used to
-- write /@language@/. The returned value is conservative;
-- if nothing is known about the language tag /@language@/,
-- 'P.True' will be returned, since, as far as Pango knows,
-- /@script@/ might be used to write /@language@/.
-- 
-- This routine is used in Pango\'s itemization process when
-- determining if a supplied language tag is relevant to
-- a particular section of text. It probably is not useful for
-- applications in most circumstances.
-- 
-- This function uses 'GI.Pango.Structs.Language.languageGetScripts' internally.
-- 
-- /Since: 1.4/
languageIncludesScript ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Language
    -- ^ /@language@/: a t'GI.Pango.Structs.Language.Language', or 'P.Nothing'
    -> Pango.Enums.Script
    -- ^ /@script@/: a t'GI.Pango.Enums.Script'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@script@/ is one of the scripts used
    -- to write /@language@/ or if nothing is known about /@language@/
    -- (including the case that /@language@/ is 'P.Nothing'),
    -- 'P.False' otherwise.
languageIncludesScript :: Language -> Script -> m Bool
languageIncludesScript Language
language Script
script = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Language
language' <- Language -> IO (Ptr Language)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Language
language
    let script' :: CInt
script' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Script -> Int) -> Script -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Script -> Int
forall a. Enum a => a -> Int
fromEnum) Script
script
    CInt
result <- Ptr Language -> CInt -> IO CInt
pango_language_includes_script Ptr Language
language' CInt
script'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Language -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Language
language
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data LanguageIncludesScriptMethodInfo
instance (signature ~ (Pango.Enums.Script -> m Bool), MonadIO m) => O.MethodInfo LanguageIncludesScriptMethodInfo Language signature where
    overloadedMethod = languageIncludesScript

#endif

-- method Language::matches
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Language" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a language tag (see pango_language_from_string()),\n           %NULL is allowed and matches nothing but '*'"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "range_list"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a list of language ranges, separated by ';', ':',\n  ',', or space characters.\n  Each element must either be '*', or a RFC 3066 language range\n  canonicalized as by pango_language_from_string()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_language_matches" pango_language_matches :: 
    Ptr Language ->                         -- language : TInterface (Name {namespace = "Pango", name = "Language"})
    CString ->                              -- range_list : TBasicType TUTF8
    IO CInt

-- | Checks if a language tag matches one of the elements in a list of
-- language ranges. A language tag is considered to match a range
-- in the list if the range is \'*\', the range is exactly the tag,
-- or the range is a prefix of the tag, and the character after it
-- in the tag is \'-\'.
languageMatches ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Language
    -- ^ /@language@/: a language tag (see 'GI.Pango.Functions.languageFromString'),
    --            'P.Nothing' is allowed and matches nothing but \'*\'
    -> T.Text
    -- ^ /@rangeList@/: a list of language ranges, separated by \';\', \':\',
    --   \',\', or space characters.
    --   Each element must either be \'*\', or a RFC 3066 language range
    --   canonicalized as by 'GI.Pango.Functions.languageFromString'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if a match was found.
languageMatches :: Language -> Text -> m Bool
languageMatches Language
language Text
rangeList = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Language
language' <- Language -> IO (Ptr Language)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Language
language
    CString
rangeList' <- Text -> IO CString
textToCString Text
rangeList
    CInt
result <- Ptr Language -> CString -> IO CInt
pango_language_matches Ptr Language
language' CString
rangeList'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Language -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Language
language
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
rangeList'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data LanguageMatchesMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo LanguageMatchesMethodInfo Language signature where
    overloadedMethod = languageMatches

#endif

-- method Language::to_string
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Language" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a language tag." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "pango_language_to_string" pango_language_to_string :: 
    Ptr Language ->                         -- language : TInterface (Name {namespace = "Pango", name = "Language"})
    IO CString

-- | Gets the RFC-3066 format string representing the given language tag.
languageToString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Language
    -- ^ /@language@/: a language tag.
    -> m T.Text
    -- ^ __Returns:__ a string representing the language tag.  This is owned by
    --          Pango and should not be freed.
languageToString :: Language -> m Text
languageToString Language
language = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Language
language' <- Language -> IO (Ptr Language)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Language
language
    CString
result <- Ptr Language -> IO CString
pango_language_to_string Ptr Language
language'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"languageToString" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Language -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Language
language
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data LanguageToStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo LanguageToStringMethodInfo Language signature where
    overloadedMethod = languageToString

#endif

-- method Language::from_string
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "language"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a string representing a language tag, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Language" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_language_from_string" pango_language_from_string :: 
    CString ->                              -- language : TBasicType TUTF8
    IO (Ptr Language)

-- | Take a RFC-3066 format language tag as a string and convert it to a
-- t'GI.Pango.Structs.Language.Language' pointer that can be efficiently copied (copy the
-- pointer) and compared with other language tags (compare the
-- pointer.)
-- 
-- This function first canonicalizes the string by converting it to
-- lowercase, mapping \'_\' to \'-\', and stripping all characters other
-- than letters and \'-\'.
-- 
-- Use 'GI.Pango.Functions.languageGetDefault' if you want to get the t'GI.Pango.Structs.Language.Language' for
-- the current locale of the process.
languageFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    -- ^ /@language@/: a string representing a language tag, or 'P.Nothing'
    -> m (Maybe Language)
    -- ^ __Returns:__ an opaque pointer to a
    --               t'GI.Pango.Structs.Language.Language' structure, or 'P.Nothing' if /@language@/ was
    --               'P.Nothing'.  The returned pointer will be valid forever
    --               after, and should not be freed.
languageFromString :: Maybe Text -> m (Maybe Language)
languageFromString Maybe Text
language = IO (Maybe Language) -> m (Maybe Language)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Language) -> m (Maybe Language))
-> IO (Maybe Language) -> m (Maybe Language)
forall a b. (a -> b) -> a -> b
$ do
    CString
maybeLanguage <- case Maybe Text
language of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jLanguage -> do
            CString
jLanguage' <- Text -> IO CString
textToCString Text
jLanguage
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jLanguage'
    Ptr Language
result <- CString -> IO (Ptr Language)
pango_language_from_string CString
maybeLanguage
    Maybe Language
maybeResult <- Ptr Language
-> (Ptr Language -> IO Language) -> IO (Maybe Language)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Language
result ((Ptr Language -> IO Language) -> IO (Maybe Language))
-> (Ptr Language -> IO Language) -> IO (Maybe Language)
forall a b. (a -> b) -> a -> b
$ \Ptr Language
result' -> do
        Language
result'' <- ((ManagedPtr Language -> Language) -> Ptr Language -> IO Language
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Language -> Language
Language) Ptr Language
result'
        Language -> IO Language
forall (m :: * -> *) a. Monad m => a -> m a
return Language
result''
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeLanguage
    Maybe Language -> IO (Maybe Language)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Language
maybeResult

#if defined(ENABLE_OVERLOADING)
#endif

-- method Language::get_default
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Language" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_language_get_default" pango_language_get_default :: 
    IO (Ptr Language)

-- | Returns the t'GI.Pango.Structs.Language.Language' for the current locale of the process.
-- Note that this can change over the life of an application.
-- 
-- On Unix systems, this is the return value is derived from
-- \<literal>setlocale(LC_CTYPE, NULL)\<\/literal>, and the user can
-- affect this through the environment variables LC_ALL, LC_CTYPE or
-- LANG (checked in that order). The locale string typically is in
-- the form lang_COUNTRY, where lang is an ISO-639 language code, and
-- COUNTRY is an ISO-3166 country code. For instance, sv_FI for
-- Swedish as written in Finland or pt_BR for Portuguese as written in
-- Brazil.
-- 
-- On Windows, the C library does not use any such environment
-- variables, and setting them won\'t affect the behavior of functions
-- like @/ctime()/@. The user sets the locale through the Regional Options
-- in the Control Panel. The C library (in the @/setlocale()/@ function)
-- does not use country and language codes, but country and language
-- names spelled out in English.
-- However, this function does check the above environment
-- variables, and does return a Unix-style locale string based on
-- either said environment variables or the thread\'s current locale.
-- 
-- Your application should call \<literal>setlocale(LC_ALL, \"\");\<\/literal>
-- for the user settings to take effect.  Gtk+ does this in its initialization
-- functions automatically (by calling @/gtk_set_locale()/@).
-- See \<literal>man setlocale\<\/literal> for more details.
-- 
-- /Since: 1.16/
languageGetDefault ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Language
    -- ^ __Returns:__ the default language as a
    --               t'GI.Pango.Structs.Language.Language', must not be freed.
languageGetDefault :: m Language
languageGetDefault  = IO Language -> m Language
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Language -> m Language) -> IO Language -> m Language
forall a b. (a -> b) -> a -> b
$ do
    Ptr Language
result <- IO (Ptr Language)
pango_language_get_default
    Text -> Ptr Language -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"languageGetDefault" Ptr Language
result
    Language
result' <- ((ManagedPtr Language -> Language) -> Ptr Language -> IO Language
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Language -> Language
Language) Ptr Language
result
    Language -> IO Language
forall (m :: * -> *) a. Monad m => a -> m a
return Language
result'

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveLanguageMethod (t :: Symbol) (o :: *) :: * where
    ResolveLanguageMethod "includesScript" o = LanguageIncludesScriptMethodInfo
    ResolveLanguageMethod "matches" o = LanguageMatchesMethodInfo
    ResolveLanguageMethod "toString" o = LanguageToStringMethodInfo
    ResolveLanguageMethod "getSampleString" o = LanguageGetSampleStringMethodInfo
    ResolveLanguageMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveLanguageMethod t Language, O.MethodInfo info Language p) => OL.IsLabel t (Language -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif