215
Views
8
Comments
[Multilingual Component] Cannot read property 'tagName' of null
Question
multilingual-mobile-component
Reactive icon
Forge asset by OutSystems

When I try to load resource from file I get the error 

Cannot read property 'tagName' of null

The json file is a resource file with deploy action "Deploy to Target Directory"

The json is just like the example

[
    {
        "locale": "pt",
        "isRightToLeft": false,
        "translations": {
            "3973c4fe-52c7-42ec-b556-ffa1aa634916": "Tarefas",
            "419ee7c8-b26a-4b6d-ac98-7c46bf22e2ed": "Data Limite não pode ser uma data no passado.",
            "UpgradeComplete": "A app foi actualizada para a versão mais recente.",
            "Validation.Mandatory": "Campo obrigatório."
        }
    }
]

Any help?

thanks

Ricardo

2021-12-27 18-59-06
Ricardo Costa

The same error occurs if I replace the AddTranslationsFromResource action for AddTranslations (adding the translations from a previous created list)

What am I missing here?

thanks

Ricardo

2020-05-07 18-53-00
Rui Barradas
 
MVP

Hello Ricardo,

Is there a reason why these lines are not defined with GUIDs?

"UpgradeComplete": "A app foi actualizada para a versão mais recente.",
"Validation.Mandatory": "Campo obrigatório."


I think that you need to define a GUID for every translation.


Kind regards,

Rui Barradas

2021-12-27 18-59-06
Ricardo Costa

Rui Barradas wrote:

Hello Ricardo,

Is there a reason why these lines are not defined with GUIDs?

"UpgradeComplete": "A app foi actualizada para a versão mais recente.",
"Validation.Mandatory": "Campo obrigatório."


I think that you need to define a GUID for every translation.


Kind regards,

Rui Barradas

Hi Rui,

acording to the documentation it doesn't need to be GUIDs

"The value of the attribute is a key (a text, also known as the “resource key”.) Keys don’tneed to follow a specific format, but you should ensure their uniqueness: two widgetswith the same key will be translated at runtime to the same value. A simple way to avoidduplicates is to use GUIDs."

One is the key and the other the value (the translated text)

Thanks

Ricardo

2020-05-07 18-53-00
Rui Barradas
 
MVP

Hi again Ricardo,

I asked about GUIDs because it's the only thing that is different from my solution. Besides that, my JSON is pretty much similar (and a lot bigger). I would give it a try, just in case.


Another thing: by any chance, do you have any other resources in your application, alongside with the JSON? Back in the days, I had some problems because I had more than one file in the resources folder. I removed it and it worked properly afterwards.


Kind regards,

Rui Barradas

2021-12-27 18-59-06
Ricardo Costa

Rui Barradas wrote:

Hi again Ricardo,

I asked about GUIDs because it's the only thing that is different from my solution. Besides that, my JSON is pretty much similar (and a lot bigger). I would give it a try, just in case.


Another thing: by any chance, do you have any other resources in your application, alongside with the JSON? Back in the days, I had some problems because I had more than one file in the resources folder. I removed it and it worked properly afterwards.


Kind regards,

Rui Barradas

Hi Rui, 

I will try that but the problem still occurs if instead of loading de translations from a resource file I add them dynamically. In that case there is no resource file so the problem must be other. 

I'm going to make more tests, maybe a clean application just with this component and try to find the problem... 

Thanks

Ricardo 


2020-05-07 18-53-00
Rui Barradas
 
MVP

Hi Ricardo,

Okay then, please try that and let us know.


Kind regards,

Rui Barradas

2021-12-27 18-59-06
Ricardo Costa

Hello,

I know now that the problem was because I have my multilingual web block inside the application's top menu and I was using OutSystems' Navigation\Submenu (with some flags to chose the language...)

I don't know why this happens but as soon as I removed the Navigation\Submenu and just used some containers/links/images the AddTranslationFromResource/AddTranslation started working.

I wiil try to get more info on this...

Thanks guys!

2020-05-07 18-53-00
Rui Barradas
 
MVP

Thank you for sharing the info Ricardo.

You should mark your own response as solution.


Kind regards,

Rui Barradas

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.