0

enter link description here

I wonder why SOURCE_LOCALE is in call caption and reason why it has underscore between them. I want to know what they are and how they work.

1 Answer 1

0

It is common to define constant values using all capitals. It is just a way to highlight a value that isn't intended to change. While Lua doesn't have technically have constants, this practice still shows up. Also, underscores can be used in variable names.

And if you read further into the article, you'll see that the SOURCE_LOCALE is used alongside the LocalizationService :

function AnimateUI.loadTranslator()
    pcall(function()
        translator = LocalizationService:GetTranslatorForPlayerAsync(Players.LocalPlayer)
    end)
    if not translator then
        pcall(function()
            translator = LocalizationService:GetTranslatorForLocaleAsync(SOURCE_LOCALE)
        end)
    end
end

And there is a note that follows :

If your game's source language is not English, change the locale code on line 4 (en) to match the game's source language setting in the localization portal.

The point of this code is to automatically translate your message into different languages. en is used to define the English locale. Other language locales include es for Spanish, de for German, and a number of others.

If you want more information, consider reading the articles and tutorials on localization.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.