Translation
in package
Table of Contents
- WPML_STRING_DOMAIN = 'MotoPress Hotel Booking'
- $locale : string
- $restoreAfterEmail : string
- $restoreLanguage : string
- __construct() : mixed
- changeLanguageForAdminEmail() : mixed
- changeLanguageForCustomerEmail() : mixed
- getCurrentId() : int|null
- getCurrentLanguage() : string
- getDefaultLanguage() : string
- getOriginalId() : int|null
- getPostTranslationIds() : array<string|int, mixed>
- Get translation ID of the posts on all languages.
- getTaxTranslationIds() : array<string|int, mixed>
- Get translation ID of the taxonomy terms on all languages.
- getWPLanguage() : string
- improveWMPLCompability() : mixed
- isActiveLanguage() : bool
- isActiveWPML() : bool
- isOriginalId() : bool
- isTranslatablePostType() : bool
- isTranslationPage() : bool
- registerWPMLString() : mixed
- resetLanguageAfterEmail() : mixed
- resetWPMLStoredLanguage() : mixed
- restoreLanguage() : mixed
- setLocaleForEmails() : string
- Set correct locale code for emails
- setupAllLanguages() : mixed
- setupDefaultLanguage() : mixed
- setWPMLDefaultLanguage() : type
- switchLanguage() : mixed
- translateAttributes() : array<string|int, int>
- translateId() : int|null
- translateRate() : Rate
- translateReservedService() : ReservedService
- translateRoomType() : RoomType
- translateService() : Service
- translateString() : string
- updateTextdomains() : mixed
- wpmlCopyPostMeta() : string
- Fill data for copy original content button
- wpmlTranslatePageId() : int
- wpmlTranslatePostId() : int
- getRestoreLanguage() : string
- Use the function before changing the site language. Otherwise getCurrentLanguage() will return wrong value.
- getAllTranslationIds() : array<string|int, mixed>
- <b>Note:</b> use methods <b>getPostTranslationIds()</b> or <b>getTaxTranslationIds()</b> to get IDs of the post or the taxonomy.
Constants
WPML_STRING_DOMAIN
public
mixed
WPML_STRING_DOMAIN
= 'MotoPress Hotel Booking'
Properties
$locale
private
string
$locale
$restoreAfterEmail
private
string
$restoreAfterEmail
= false
$restoreLanguage
private
string
$restoreLanguage
= null
Methods
__construct()
public
__construct() : mixed
Return values
mixed —changeLanguageForAdminEmail()
public
changeLanguageForAdminEmail(Booking $booking) : mixed
Parameters
- $booking : Booking
Return values
mixed —changeLanguageForCustomerEmail()
public
changeLanguageForCustomerEmail(Booking $booking) : mixed
Parameters
- $booking : Booking
Return values
mixed —getCurrentId()
public
getCurrentId(int $id, string $type[, bool $returnOriginal = true ]) : int|null
Parameters
- $id : int
- $type : string
- $returnOriginal : bool = true
-
Optional. true by default.
Return values
int|null —getCurrentLanguage()
public
getCurrentLanguage() : string
Return values
string —getDefaultLanguage()
public
getDefaultLanguage() : string
Return values
string —getOriginalId()
public
getOriginalId(int $id, string $type[, bool $returnOriginal = true ]) : int|null
Parameters
- $id : int
- $type : string
- $returnOriginal : bool = true
-
Optional. true by default.
Return values
int|null —getPostTranslationIds()
Get translation ID of the posts on all languages.
public
getPostTranslationIds(int $id[, string $type = 'post' ]) : array<string|int, mixed>
Parameters
- $id : int
-
ID of the post on any language.
- $type : string = 'post'
-
Optional. Post type. "post" by default.
Return values
array<string|int, mixed> —[%Language code% => %Translation ID%]. Example: ["en" => 768, "uk" => 771]
getTaxTranslationIds()
Get translation ID of the taxonomy terms on all languages.
public
getTaxTranslationIds(int $id[, string $type = 'category' ]) : array<string|int, mixed>
Parameters
- $id : int
-
ID of the taxonomy term on any language.
- $type : string = 'category'
-
Optional. Taxonomy name. "category" by default.
Return values
array<string|int, mixed> —[%Language code% => %Translation ID%]. Example: ["en" => 768, "uk" => 771]
getWPLanguage()
public
getWPLanguage() : string
Return values
string —improveWMPLCompability()
public
improveWMPLCompability() : mixed
Return values
mixed —isActiveLanguage()
public
isActiveLanguage(string $language) : bool
Parameters
- $language : string
Return values
bool —isActiveWPML()
public
isActiveWPML() : bool
Return values
bool —isOriginalId()
public
isOriginalId(int $id, string $type) : bool
Parameters
- $id : int
- $type : string
Return values
bool —isTranslatablePostType()
public
isTranslatablePostType(string $postType) : bool
Parameters
- $postType : string
Return values
bool —isTranslationPage()
public
isTranslationPage() : bool
Return values
bool —registerWPMLString()
public
registerWPMLString(string $name, string $value[, string $context = null ]) : mixed
Parameters
- $name : string
- $value : string
- $context : string = null
Return values
mixed —resetLanguageAfterEmail()
public
resetLanguageAfterEmail(Booking $booking) : mixed
Parameters
- $booking : Booking
Return values
mixed —resetWPMLStoredLanguage()
public
resetWPMLStoredLanguage(mixed $atts) : mixed
Parameters
- $atts : mixed
Return values
mixed —restoreLanguage()
public
restoreLanguage() : mixed
Return values
mixed —setLocaleForEmails()
Set correct locale code for emails
public
setLocaleForEmails(string $locale, string $domain) : string
Parameters
- $locale : string
- $domain : string
Return values
string —setupAllLanguages()
public
setupAllLanguages() : mixed
Return values
mixed —setupDefaultLanguage()
public
setupDefaultLanguage() : mixed
Return values
mixed —setWPMLDefaultLanguage()
public
setWPMLDefaultLanguage(type $atts) : type
Parameters
- $atts : type
Return values
type —switchLanguage()
public
switchLanguage([mixed $language = null ]) : mixed
Parameters
- $language : mixed = null
Return values
mixed —translateAttributes()
public
translateAttributes(array<string|int, mixed> $attributes[, string $language = null ]) : array<string|int, int>
Parameters
- $attributes : array<string|int, mixed>
-
[%Attribute name% => %Attribute ID%]
- $language : string = null
-
Optional. Current language by default.
Return values
array<string|int, int> —translateId()
public
translateId(int $id[, string $type = null ][, string $language = null ][, bool $returnOriginal = true ]) : int|null
Parameters
- $id : int
- $type : string = null
-
Optional. Use post, page, {custom post type name}, nav_menu, nav_menu_item, category, tag, etc. You can also pass 'any', to let WPML guess the type, but this will only work for posts. 'any' by default.
- $language : string = null
-
Optional. Current language by default
- $returnOriginal : bool = true
-
Optional. true by default.
Return values
int|null —translateRate()
public
translateRate(Rate $rate[, string $language = null ]) : Rate
Parameters
- $rate : Rate
- $language : string = null
-
Optional. Current Language by default.
Return values
Rate —translateReservedService()
public
translateReservedService(ReservedService $reservedService[, string $language = null ]) : ReservedService
Parameters
- $reservedService : ReservedService
- $language : string = null
-
Optional. Current Language by default.
Return values
ReservedService —translateRoomType()
public
translateRoomType(RoomType $roomType[, string $language = null ]) : RoomType
Parameters
- $roomType : RoomType
- $language : string = null
-
Optional. Current Language by default.
Return values
RoomType —translateService()
public
translateService(Service $service[, string $language = null ]) : Service
Parameters
- $service : Service
- $language : string = null
-
Optional. Current Language by default.
Return values
Service —translateString()
public
translateString(string $value, string $name[, string $context = null ][, string $language = null ]) : string
Parameters
- $value : string
- $name : string
- $context : string = null
- $language : string = null
Return values
string —updateTextdomains()
public
updateTextdomains() : mixed
Return values
mixed —wpmlCopyPostMeta()
Fill data for copy original content button
public
wpmlCopyPostMeta(type $data) : string
Parameters
- $data : type
Return values
string —wpmlTranslatePageId()
public
wpmlTranslatePageId(int $id[, string $language = null ]) : int
Parameters
- $id : int
- $language : string = null
-
Optional. Current Language by default.
Return values
int —wpmlTranslatePostId()
public
wpmlTranslatePostId(int $id[, string $language = null ]) : int
Parameters
- $id : int
- $language : string = null
-
Optional. Current Language by default.
Return values
int —getRestoreLanguage()
Use the function before changing the site language. Otherwise getCurrentLanguage() will return wrong value.
protected
getRestoreLanguage() : string
Tags
Return values
string —Language code like "en", "uk", "ru" etc.
getAllTranslationIds()
<b>Note:</b> use methods <b>getPostTranslationIds()</b> or <b>getTaxTranslationIds()</b> to get IDs of the post or the taxonomy.
private
getAllTranslationIds(int $id, string $type) : array<string|int, mixed>
Get translation ID of the objects on all languages.
Parameters
- $id : int
-
ID of the object on any language.
- $type : string
-
Object type (with prefix, like "post_", "tax_" etc.).
Tags
Return values
array<string|int, mixed> —[%Language code% => %Translation ID%]. Example: ["en" => 768, "uk" => 771]