Documentation

TtsService

Service class for Text-to-Speech settings.

Tags
category

Lwt

author

HugoFara hugo.farajallah@protonmail.com

license

Unlicense http://unlicense.org/

link
https://hugofara.github.io/lwt/docs/php/
since
3.0.0

Table of Contents

Properties

$languageService  : LanguageFacade
Language facade instance.

Methods

__construct()  : mixed
Constructor - initialize dependencies.
getCurrentLanguageCode()  : string
Get current language code for TTS settings.
getLanguageCode()  : string
Get two-letter language code from language ID.
getLanguageIdFromCode()  : int
Get language ID from two-letter code or BCP 47 tag.
getLanguageOptions()  : string
Get language options for TTS form.
saveSettings()  : void
Save TTS settings as cookies.

Properties

Methods

__construct()

Constructor - initialize dependencies.

public __construct([LanguageFacade|null $languageService = null ]) : mixed
Parameters
$languageService : LanguageFacade|null = null

Language facade (optional for BC)

getCurrentLanguageCode()

Get current language code for TTS settings.

public getCurrentLanguageCode(array<string, array{0: string, 1: string, 2: bool, 3: string, 4: string, 5: bool, 6: bool, 7: bool}> $langArray) : string
Parameters
$langArray : array<string, array{0: string, 1: string, 2: bool, 3: string, 4: string, 5: bool, 6: bool, 7: bool}>

Languages array from langdefs

Return values
string

Current language code

getLanguageCode()

Get two-letter language code from language ID.

public getLanguageCode(int $lgId, array<string, array{0: string, 1: string, 2: bool, 3: string, 4: string, 5: bool, 6: bool, 7: bool}> $langArray) : string
Parameters
$lgId : int

Language ID

$langArray : array<string, array{0: string, 1: string, 2: bool, 3: string, 4: string, 5: bool, 6: bool, 7: bool}>

Languages array from langdefs

Return values
string

Two-letter language code

getLanguageIdFromCode()

Get language ID from two-letter code or BCP 47 tag.

public getLanguageIdFromCode(string $code, array<string, array<string|int, string>> $langArray) : int
Parameters
$code : string

Two letters, or four letters separated with caret

$langArray : array<string, array<string|int, string>>

Languages array from langdefs

Return values
int

Language ID if found, -1 otherwise.

getLanguageOptions()

Get language options for TTS form.

public getLanguageOptions(array<string, array{0: string, 1: string, 2: bool, 3: string, 4: string, 5: bool, 6: bool, 7: bool}> $langArray) : string
Parameters
$langArray : array<string, array{0: string, 1: string, 2: bool, 3: string, 4: string, 5: bool, 6: bool, 7: bool}>

Languages array from langdefs

Return values
string

HTML-formatted options string

saveSettings()

Save TTS settings as cookies.

public saveSettings() : void

        
On this page

Search results