Utilities
The following utility functions are available:
Impostor.coerse_string_type
— Functioncoerse_string_type(v::Vector{<:AbstractString}) :: Union{String, Vector{String}}
Automatically unpack the return value of a generator function into a single string, when appropriate.
Parameters
v::Vector{<:AbstractString}
: value(s) returned by some generator function.
Example
julia> Impostor.coerse_string_type(["Mark"])
"Mark"
julia> Impostor.coerse_string_type(["Mark", "Jane"])
2-element Vector{String}:
"Mark"
"Jane"
Impostor.setlocale!
— Functionsetlocale!(loc::String)
setlocale!(loc::Vector{<:AbstractString})
Set loc
as the default locale for the current session.
Impostor.session_locale
— Functionsession_locale() :: Vector{String}
Return the current session locale.
Impostor.resetlocale!
— Functionresetlocale!()
Reset the current session locale to "en_US"
.
Impostor.is_provider_available
— Functionis_provider_available(p::AbstractString) :: Bool
Return whether the provided p
is available.
Parameters
p::AbstractString
: provider name
Impostor.is_content_available
— Functionis_content_available(p::T, c::T) :: Bool where {T <: AbstractString}
Return whether the content c
is available for provider p
.
Parameters
p::AbstractString
: provider namec::AbstractString
: content name
Impostor.is_locale_available
— Functionis_locale_available(p::T, c::T, l::T) :: Bool where {T <: AbstractString}
Return whether the provided locale l
is available for content c
from provider p
.
Parameters
p::AbstractString
: provider namec::AbstractString
: content namel::AbstractString
: locale name