In Studio, both LocalizationService:GetTranslatorForLocaleAsync and LocalizationService:GetTranslatorForPlayerAsync take upwards of 10 seconds to execute. This occurs regardless of whether the method was recently executed with the same arguments or not. The following code example can reproduce this issue, taking ~10 seconds for each method call:
local localisation = game:GetService("LocalizationService")
local c = os.clock()
localisation:GetTranslatorForLocaleAsync("en-us")
warn("Time taken (english): "..os.clock()-c)
local c = os.clock()
localisation:GetTranslatorForLocaleAsync("en-us")
warn("Time taken (english again): "..os.clock()-c)
local c = os.clock()
localisation:GetTranslatorForLocaleAsync("es-es")
warn("Time taken (spanish): "..os.clock()-c)
In a live experience, this does not occur. Both on the client and on the server, running each of these methods takes, at most, roughly one second from my personal tests. One second is still quite unreasonable for what in my case is just a single localisation entry but it is much more reasonable than a ten second yield. In a live experience, results also appear to be cached, unlike Studio which yields for 10 seconds regardless of whether the result should be cached or not. This has led me to believe that perhaps both methods just have a guarenteed 10 second yield for some reason.
It’s also worth noting that, when downloading them, the CSV form of my translations appears to be incorrect; essentially being a blank table with only column headers, which could be related to this issue. However, this yiedling bug occurs even on some of my other experiences which do not contain any localisation entries.
Beta Features:
I have all beta features except “Next Gen Explorer” and “CreateAssetAsync Lua API” enabled.
Expected behavior
I expect a much more reasonable execution time than 10 full seconds.
A private message is associated with this bug report