I need to know how to use the new component, how the strings.xml could be structured
Well, thanks for sharing. But it is not clear to me because it does not work and all the components disappear
Because your join is supposed to be like this ColinTreeSysLanguage1.SysLang_hello_world
.Edited out just reread the steps. Like this:
In my Strings.xml
I have this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="eng_screen1_title">Eh</string>
<string name="spa_screen1_title">Eh</string>
<string name="ita_screen1_title">Eh</string>
<string name="hun_screen1_title">Eh</string>
</resources>
JUST A NOTE
It doesn’t work on Emulators or the Companion, it’s required you test on a real device with the APK have been Built.
Well, I’m not a baby … just that I’m not on the backend side and I do not really know how it works, I see that it’s very “personalized”, so there’s nothing wrong with asking if there’s still no documentation, or ask for an example project
Wow…
The same says the component by herself if you use it with companion…
where do i get the list of language code like - eng_ , spa_ , ita_ etc.
Just use the device tools component.
Nobody must use any other extension for that because we already can return the device language/country.
Example:
The file name must be current: “strings.xml”.
And the content must only be strings like below:
<string name=“en_forward_target”>Hello</string>
<string name=“es_forward_target”>Hola</string>
<string name=“de_forward_target”>Hallo</string>
<string name=“en_404”>There was a problem</string>
<string name=“es_404”>Había un problema</string>
<string name=“de_404”>Es ist ein Fehler aufgetreten</string>
It is recommended to use this component just for testing and not for production since the blocks will be changed soon for a stable component.
one more help @mika,
here in eng_screen1_title - eng is the system language code and _screen1_title is the string name to fetch the data from xml file right?
i tried this and its not working, can you please check,
file name - strings.xml
xml file content -
<string name="en_label">Hello</string>
<string name="es_label">Hola</string>
<string name="hi_label">नमस्ते</string>
blocks -
output -
i tried your guide, but still didn’t work, instead of getting output from xml file, resource name is printing. i think i should wait for the stable version,
Because of this:
Look at the point: “If Resource Not Found Use”…
You added there “en_label” this will be your text if the resource can not be found.
And now read the guide complete:
Correct.
i read it properly, and to make sure i get the good result i also used your example.
i also want to test this component properly, so sorry if i am bothering you.
Block -
XML file structure -
output-
Read it please again
Good. I thought that the component has many errors … I just added it, all the elements on the screen disappear in Companion, but in the compilation it appears. It was because the Companion App has an update (nobody told me). Even so, that component in Companion is not allowed to be used. I hope so in the future.
Then … in the string.xml where it will contain the language texts, it will have a structure as mentioned by Diego:
Then in Kodular Creator the SUPER BLOCK is used to check two things: if in the .xml file it has the following ID (ID of the device language + “_exampletext”), then it loads the text “Hello” or the language that I detect and that have the text If you do not have that text, then load this “Hello” string or whatever else you put in it. This detects two things, if it is an ID of a text, or if it is a text, putting as priority 1 the ID and 2 the text.
Here it collects the ID (es) + _hello; if not a text “Hello”:
Here it collects the ID (es) + _hello; if not an ID en_hello:
Note: the .xml file should be called only strings.xml, not otherwise. The component “Resource File (strings.xml)”. This component is still test, so it only works in compilations, not in Companion or emulators. I have had problems loading the string.xml, just load parts and others display them as “xx_xxxx”
Strings.aia (3,8 KB)
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.