Resource Utilities - How to use the new component

Hello koders!
In this guide I will show you how to use the new resource utilities component which can be found in the “Utilieties” category.

The component is really easy to use. Create your own json file with all your strings. Upload it… DONE.

Okay… Maybe that’s a bit too fast.
The image below will show you all steps you need to do for a “perfect” solution.

strings.json (238 Bytes)
ResourceGuide.aia (2,6 KB)

The JSON file must have a valid format, like the following one

{
     	"de_string1": "Hallo",
     	"en_string1": "Hello",
     	"es_string1": "Hola",
     	"de_string2": "Welt!",
     	"en_string2": "World!",
     	"es_string2": "Mundo!"
}

The blocks:
Use this block if you want to use your resources from a file which is stored in the assets folder of your app.
blocks%20(1)
blocks%20(2)
Use this block if you want to use your resources from any file path like external storage or online file.

The ’resource Name’ is like in the example json file something like that:
de_string1 and the content of this resource is Hallo

blocks2

The ‘if Resource Not Found Use’ is nothing else as a default text which is later used if the block can not find the given ‘resource Name’.


Why should you use this component?
The main problem in app development is the static/fixed text for components like labels.
An English user will not understand German text, for example.

If the app developer provides more languages, it is easier to use a app outside of the country.


Have much fun with this new component!

40 Likes

Nice tutorial. :+1:

4 Likes

Nice …:blush:

3 Likes

Very good, @Mika

2 Likes

All the information and detail needed to make a multilingual app.

Nice job Mika.

2 Likes

I’m getting this error:

The operation select list item cannot accept the arguments: , [There was a problem to get the string ‘pt_NothingFound’. Make sure on your side is all correct.], [2]

I follow the tutorial and I cant find the cause of this error!

Any help?

Note: I’m using Companion!

1 Like

Show the blocks you made and the strings.json file.

1 Like

6e98109653ff0d35b461d3b27e1924f8

1cc6545d54820bf0da56f9dfd446e170

2 Likes

What if you use the blocks in the first post of this topic?

2 Likes

I made a test with the same blocks of the first post!
Don’t work either!

I also used the ResourceGuide.aia , and the same problem occurs!

1 Like

I don’t know if yours is the same case, but the first time I tried to use the component somehow I believed that I could use any name for the json file instead of strings.json, and then the procedure didn’t work until I used the correct file name.

2 Likes

I want to translate my application from Google translation service,
But they want to upload a strings.xml or CSV file
I use the json file in my application, can I send them a json file or somehow convert the json file to an XML file?

1 Like

You can try this site:


Or this:

Here you can convert JSON to XML or CSV.

2 Likes

Thanks I will try it​:smiley:

I finished editing the translation file,
I converted the file from json to xml
And when I uploaded the translation file to Google’s translation service there was an error message
I didn’t really understand what the problem was
Here’s a screenshot:

1 Like

I also tried to convert the file to CSV (UTF-8) and it shows the same message.
what can we do?

Resource Utilities has a serious bug.


I have tried to use a JSON file, like shown in the tutorial, but it gives the error: "there was a problem to get the string ‘nl_app’. Make sure on your side is all correct. Reading the Kodular docs about the Resource Utilities I noticed it says XML and not JSON. But changing the data from JSON to a XML file still gives the same error. See Resource Utilities documentation about XML resource.

XML

<?xml version="1.0" encoding="UTF-8" ?>

<nl_app>app</nl_app>
<en_app>app</en_app>
<de_app>app</de_app>
<es_app>aplicación</es_app>
<fr_app>app</fr_app>

JSON
{
“nl_app”:“programma”,
“en_app”:“app”,
“de_app”:“app”,
“es_app”:“aplicación”,
“fr_app”:“app”
}

By the way: I cannot download the tutorial aia file to test the tutorial.

2 Likes

This problem happens if you test it on a live test. To get the translation you need to download the app to your device.

2 Likes

Problem with download demo aia file

1 Like

You should read the doc and tutorial again.
It must be a json format file and NOT xml.

Just use the example aia.
Install it on a real device. Test it