How to translate a script generated text?

I created a project, with the source language as Portuguese, just for testing which generates a text inside a TextLabel, through a script:

local Fruits = {'Laranja','Banana','Tomate'}
local CurrentFruit = 3 -- this will be changed during the game
for Id, Fruit in ipairs(Fruits) do
	if Id == CurrentFruit then 
		game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Text = 'Minha fruta: ' .. Fruit
	end
end

When running in Roblox Player, I get:
image

(which means My fruit: Tomato)

As you can see, there are still 2 fruits that were not shown in the list above (which may be shown according to other game conditions).

I already know that Roblox doesn’t do automatic translations when the source language is other than English, so I have to do it manually through the Translation Portal.

When running the game in Roblox Player, the strings are automatically exported to the Translation Portal:

But, as you can see above, only 1 sentence was exported, which was shown in the game.

How to proceed in the case of other phrases that have not yet appeared in the game?
Will I have to make them appear manually one by one?
What if I have a table with HUNDREDS of sentences inside the script?
How to proceed in this case?

I managed to solve this by using Substrings:
https://create.roblox.com/docs/production/localization/translating-dynamic-content#translating-substrings
So I have only one sentence for the prefix and individual translations for each fruit:

And here are the results:

Original (Portuguese):

Translated (English):
image

3 Likes