Apprendre
Classe de moteur
LocalizationService
Création impossible
Service
Non répliqué

*Ce contenu est traduit en utilisant l'IA (Beta) et peut contenir des erreurs. Pour consulter cette page en anglais, clique ici.



Référence API
Propriétés
RobloxLocaleId
Lecture uniquement
Non répliqué
Lecture parallèle
Capacités : Basic
LocalizationService.RobloxLocaleId:string

SystemLocaleId
Lecture uniquement
Non répliqué
Lecture parallèle
Capacités : Basic
LocalizationService.SystemLocaleId:string

Méthodes
GetCorescriptLocalizations
Capacités : Basic
LocalizationService:GetCorescriptLocalizations():Instances
Retours
Instances

GetCountryRegionForPlayerAsync
Rendement
Capacités : Basic
LocalizationService:GetCountryRegionForPlayerAsync(player:Instance):string
Paramètres
player:Instance
Retours
Échantillons de code
Obtenir le code Pays/Région pour un joueur
local LocalizationService = game:GetService("LocalizationService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local result, code = pcall(LocalizationService.GetCountryRegionForPlayerAsync, LocalizationService, player)
if result and code == "CA" then
print("Bonjour, ami du Canada !")
else
print("GetCountryRegionForPlayerAsync a échoué : " .. code)
end

GetTableEntries
Capacités : Basic
LocalizationService:GetTableEntries(instance:Instance):{any}
Paramètres
instance:Instance
Valeur par défaut : "nil"
Retours

GetTranslatorForLocaleAsync
Rendement
Capacités : Basic
LocalizationService:GetTranslatorForLocaleAsync(locale:string):Instance
Paramètres
locale:string
Retours
Échantillons de code
Obtenir et utiliser un traducteur pour une locale
local LocalizationService = game:GetService("LocalizationService")
local textLabel = script.Parent
local success, translator = pcall(function()
return LocalizationService:GetTranslatorForLocaleAsync("fr")
end)
if success then
local result = translator:Translate(textLabel, "Hello World!")
print("Bonjour en français: " .. result)
else
print("GetTranslatorForLocaleAsync failed: " .. translator)
end

GetTranslatorForPlayer
Déprécié

GetTranslatorForPlayerAsync
Rendement
Capacités : Basic
LocalizationService:GetTranslatorForPlayerAsync(player:Instance):Instance
Paramètres
player:Instance
Retours
Échantillons de code
Obtenir et utiliser un traducteur pour un joueur
local LocalizationService = game:GetService("LocalizationService")
local Players = game:GetService("Players")
local textLabel = script.Parent
local success, translator = pcall(function()
return LocalizationService:GetTranslatorForPlayerAsync(Players.LocalPlayer)
end)
if success then
local result = translator:Translate(textLabel, "Hello World!")
print(result)
else
print("GetTranslatorForPlayerAsync failed: " .. translator)
end

©2026 Société Roblox. Roblox, le logo Roblox et Powering Imagination font partie de nos marques déposées aux États-Unis et dans d'autres pays.