Language
open class Language : LanguageProtocol
The PangoLanguage
structure is used to
represent a language.
PangoLanguage
pointers can be efficiently
copied and compared with each other.
The Language
type acts as an owner of an underlying PangoLanguage
instance.
It provides the methods that can operate on this data type through LanguageProtocol
conformance.
Use Language
as a strong reference or owner of a PangoLanguage
instance.
-
Untyped pointer to the underlying `PangoLanguage` instance.
For type-safe access, use the generated, typed pointer
language_ptr
property instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theLanguage
instance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<PangoLanguage>)
Parameters
op
pointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theLanguage
instance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<PangoLanguage>)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a non-mutating
gpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theLanguage
instance.Declaration
Swift
@inlinable public init!(gpointer op: gpointer?)
Parameters
op
gpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theLanguage
instance.Declaration
Swift
@inlinable public init!(gconstpointer op: gconstpointer?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theLanguage
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<PangoLanguage>?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theLanguage
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<PangoLanguage>?)
Parameters
op
pointer to the underlying object
-
Designated initialiser from the underlying
C
data type.PangoLanguage
does not allow reference counting, so despite the name no actual retaining will occur. i.e., ownership is transferred to theLanguage
instance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<PangoLanguage>)
Parameters
op
pointer to the underlying object
-
Reference intialiser for a related type that implements
LanguageProtocol
PangoLanguage
does not allow reference counting.Declaration
Swift
@inlinable public init<T>(_ other: T) where T : LanguageProtocol
Parameters
other
an instance of a related type that implements
LanguageProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LanguageProtocol
.Declaration
Swift
@inlinable public init<T>(cPointer p: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LanguageProtocol
.Declaration
Swift
@inlinable public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LanguageProtocol
.Declaration
Swift
@inlinable public init(raw p: UnsafeRawPointer)
Parameters
p
raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LanguageProtocol
.Declaration
Swift
@inlinable public init(retainingRaw raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LanguageProtocol
.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)
Parameters
p
mutable raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LanguageProtocol
.Declaration
Swift
@inlinable public init(retainingRaw raw: UnsafeMutableRawPointer)
Parameters
raw
mutable raw pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LanguageProtocol
.Declaration
Swift
@inlinable public init(opaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
LanguageProtocol
.Declaration
Swift
@inlinable public init(retainingOpaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Convert a language tag to a
PangoLanguage
.The language tag must be in a RFC-3066 format.
PangoLanguage
pointers 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 [func
Pango.Language.get_default
] if you want to get thePangoLanguage
for the current locale of the process.Declaration
Swift
@inlinable public static func from(string language: UnsafePointer<CChar>? = nil) -> Pango.Language!
-
Returns the
PangoLanguage
for the current locale of the process.On Unix systems, this is the return value is derived from
setlocale (LC_CTYPE, NULL)
, 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 thesetlocale()
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
setlocale(LC_ALL, "")
for the user settings to take effect. GTK does this in its initialization functions automatically (by callinggtk_set_locale()
). See thesetlocale()
manpage for more details.Note that the default language can change over the life of an application.
Also note that this function will not do the right thing if you use per-thread locales with
uselocale()
. In that case, you should just callpango_language_from_string()
yourself.Declaration
Swift
@inlinable public static func getDefault() -> Pango.Language!