{-# LINE 1 "Data/Text/ICU/Locale.hsc" #-}
{-# LANGUAGE RankNTypes, BangPatterns, ForeignFunctionInterface, RecordWildCards #-}
module Data.Text.ICU.Locale
(availableLocales
) where
import Control.Monad (forM)
import Data.Int (Int32)
import Foreign.C.String (CString, peekCString)
import Prelude hiding (last)
availableLocales :: IO [String]
availableLocales = do
n <- uloc_countAvailable
forM [0..n-1] $ \i -> uloc_getAvailable i >>= peekCString
foreign import ccall unsafe "hs_text_icu.h __hs_uloc_getAvailable" uloc_getAvailable
:: Int32 -> IO CString
foreign import ccall unsafe "hs_text_icu.h __hs_uloc_countAvailable" uloc_countAvailable
:: IO Int32