openSUSE / software-o-o

The site behind https://software.opensuse.org. It is the default web interface to download openSUSE distributions and to search for OBS packages. Packaged at https://build.opensuse.org/project/show/openSUSE:infrastructure:software.opensuse.org
https://software.opensuse.org/
GNU General Public License v2.0
139 stars 111 forks source link

Software page error navigating in Catalan #596

Open Davidmp1 opened 5 years ago

Davidmp1 commented 5 years ago

When navigating beyond (and from) the landing page selecting the catalan language, an error message appears:

(): mapping values are not allowed in this context at line 1 column 21

See, for instance, the catalan version for the following page, and then change it to any other language:

https://software.opensuse.org/distributions/leap

Is this due to a bad translated string or is it the page? Does it need some refreshing? It happens since last update for the 15.1 release.

This issue is also filed as a bug:

https://bugzilla.opensuse.org/show_bug.cgi?id=1136684

Thanks.

agraul commented 5 years ago

Thanks for your report! This definitely needs some investigation, translations should not break :cry:

This issue is also filed as a bug

In the future, please stick to one issue tracker (preferably this one). If there are two tickets for the same problem they could go out of sync.

mbgg commented 5 years ago

any news on that? I just got hit by this again.

agraul commented 5 years ago

I did not get around to looking at this yet :cry:

agraul commented 5 years ago

I found the cause: In the application, we load the distribution information from YAML files that contain strings that are translated. When the strings that are translated into Catalan are inserted in the file, it results in YAML-data that can't be parsed. This is due to the fact that the Catalan translations end with colons in places they should not, e.g. https://github.com/openSUSE/software-o-o/blob/master/locale/ca/software.po#L516.

That example string results in basically this code:

require 'yaml'

YAML.safe_load("- name: Instal·lació:")

which causes a backtrace with the error message that you see on the webpage:

Traceback (most recent call last):
        4: from repro-ca.rb:3:in `<main>'
        3: from /usr/lib64/ruby/2.6.0/psych.rb:349:in `safe_load'
        2: from /usr/lib64/ruby/2.6.0/psych.rb:390:in `parse'
        1: from /usr/lib64/ruby/2.6.0/psych.rb:456:in `parse_stream'
/usr/lib64/ruby/2.6.0/psych.rb:456:in `parse': (<unknown>): mapping values are not allowed in this context at line 1 column 21 (Psych::SyntaxError)
Davidmp1 commented 5 years ago

Hello,

I have changed it on weblate. There were tree more similar cases: the tab titles. Feel free to make other corrections. Many regards,

David

Missatge de Alexander Graul notifications@github.com del dia dt., 27 d’ag. 2019 a les 20:06:

I found the cause: In the application, we load the distribution information from YAML files that contain strings that are translated. When the strings that are translated into Catalan are inserted in the file, it results in YAML-data that can't be parsed. This is due to the fact that the Catalan translations end with colons in places they should not, e.g. https://github.com/openSUSE/software-o-o/blob/master/locale/ca/software.po#L516 .

That example string results in basically this code:

require 'yaml'

YAML.safe_load("- name: Instal·lació:")

which causes a backtrace with the error message that you see on the webpage:

Traceback (most recent call last):

    4: from repro-ca.rb:3:in `<main>'
    3: from /usr/lib64/ruby/2.6.0/psych.rb:349:in `safe_load'
    2: from /usr/lib64/ruby/2.6.0/psych.rb:390:in `parse'

    1: from /usr/lib64/ruby/2.6.0/psych.rb:456:in `parse_stream'

/usr/lib64/ruby/2.6.0/psych.rb:456:in `parse': (): mapping values are not allowed in this context at line 1 column 21 (Psych::SyntaxError)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/openSUSE/software-o-o/issues/596?email_source=notifications&email_token=ACB5LZG5BYK5OG46SA6ZCDDQGVUJFA5CNFSM4HQQXLF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5ITZYY#issuecomment-525417699, or mute the thread https://github.com/notifications/unsubscribe-auth/ACB5LZBI3SL6PEFX425L6FDQGVUJFANCNFSM4HQQXLFQ .

agraul commented 5 years ago

Unfortunately the corrected translations don't work either, but that is something on our side I think - the side does load, but switching tabs don't work. I think it is due to the fact that we overuse the translations, they are also used for html ids

agraul commented 5 years ago

I can confirm that the tabs not working is due to spaces in the tab names. I try to come up with a solution that does not require the translations to change

Ana06 commented 4 years ago

@agraul

I think it is due to the fact that we overuse the translations, they are also used for html ids

Translations shouldn't be used for the ids, I'll take a look! :wink: