Translation Test

by pokemaster6387
See Code Download Embed
PLEASE NOTE: Carrot's translation isn't broken, its just showing of the translate [] with the fallback of [] block.

This is a quick sample I made of a translation system inspired by Minecraft's. Feel free to copy and paste into any project you want, just please give credit! It uses a custom sensing block called translate []. I tried my best to make it flexable. Click any flag to translate. NOTE: I highly recommend using turbo mode to make large amounts of translations go faster. You can also probably make sub languages if its still too slow.

How To Use:
You must have two variables: Lang and Selected Language
Lang holds the translation keys, and Selected Language stores wich language to translate from.
Lang must have this structure:
First, a list. In the list, put the name of the language you want to use. Then, on the next part of the list, add a list. In that list, frist, put the text of your translation key, and in the next slot, put a list with your translation. If you need to see it, look inside at the code.
Selected Language holds the data for which language you want to translate from. Must be the same as one of the first layer of texts in the Lang variable.

Change Log:
1.1: 
-Changed the Translate [] block to saying translate [] for consistancy with other Snap! blocks.
-Made the reporter report the translation key if no language is found, instead of not reporting anything.
-Made the reporter report the translation key if no key is found, instead of breaking the code.
-Updated compatability with translate so it can have any input, rather than only text.
-Added a new block: translate [] with the fallback of []. Basically the same as translate, but if no translation key is found, it will report whatever is in the fallback field, instead of the translation key.

Created November 26, 2024

Last updated March 25, 2025

Published November 26, 2024