Is there a way to detect a player's roblox default language?

Hey guys! I hope you are doing very very well! Being direct as always here’s my problem:

  1. What do you want to achieve?
    Translate a typewriter function from english text to other type of languages manually (and so translate the game).

Here’s the function and how you summon it:

local function typewrite (object, text, length, initialText)
	initialText = initialText or ""
	for i = 1, #text,1 do
		object.Text = initialText..string.sub(text,1, i)
		task.wait (length)
	end
end
typewrite (TextLabel, "Example text", 0.07) -- Gui localization, text to typewrite, and seconds which should last.

For ex: If I wrote a text in the typewriter function that says “Hello there!”, I would want a way to detect the player’s roblox web language and so that way I can make and “if statement” so the typewriter writes different things.

if player.English == true then

   typewrite(TextLabel, "English test example", 0.03)

elseif player.French == true then

   typewrite(Textlabel, "French test exemple", 0.03 )

elseif player.Spanish == true then

   typewrite(Textlabel, "Test de ejemplo", 0.03 )

elseif player.Japanese == true then

   typewrite(Textlabel, "試験例", 0.03 )

end
  1. What is the issue? Roblox localization page doesn’t work when using this function.

  2. What solutions have you tried so far? Searching on youtube and searching on the Internet in general.

Thank you for everything and have a nice day and life! byee! :grinning_face_with_smiling_eyes: :wave: :smiley:

The way you’ve done this is incredibly inefficent

local function typewrite(object, text, length)
  local len = length/#text
  object.Text = ''
  for _, char in ipairs(text:split('')) do
    object.Text ..= char
    task.wait(len)
  end
end

typewrite(TextLabel, 'trolled', 3) -- will take around 3 seconds
2 Likes

Thanks, though you don’t know any way to translate it manually? without going to the localization web?

I’m still quite confused on how a type writer connects to translation.

I’m pretty sure the translation page is the best and only way to do it, I think you could do the translations yourself.

I’m not too good with localisation and I may of misread your question.

1 Like

Hi there! There are some code snippets on how to localize with scripts in this docs site article. This shows how to get a player’s language too.

2 Likes

Thank you very much! I would not have found this precious information without your help! :grinning_face_with_smiling_eyes:

1 Like