Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n.properties files cannot be viewed at command "Preview: Open URL" #7231

Closed
i501378 opened this issue Feb 27, 2020 · 12 comments · Fixed by #7356
Closed

i18n.properties files cannot be viewed at command "Preview: Open URL" #7231

i501378 opened this issue Feb 27, 2020 · 12 comments · Fixed by #7356
Labels
bug bugs found in the application help wanted issues meant to be picked up, require help mini-browser issues related to the mini-browser

Comments

@i501378
Copy link
Contributor

i501378 commented Feb 27, 2020

Description

We need to view the files by calling the command "Preview: Open URL"
General file types are OK, but i18n.properties files cannot be viewed now.

Reproduction Steps

  1. create or upload file "i18n.properties" into the root of workspace.

  2. execute command "Preview: Open URL", and input the url as file:///workspace/theia/i18n.properties

  3. it's not shown in the preview widget.

**OS and Theia version: gitpod latest version

Diagnostics:

@akosyakov akosyakov added mini-browser issues related to the mini-browser bug bugs found in the application help wanted issues meant to be picked up, require help labels Feb 27, 2020
@vince-fugnitto
Copy link
Member

@i501378 do you have an example project with a i18n.properties file so we can verify the issue? You mentioned that:

i18n.properties files cannot be viewed now

Was it ever the case that the file could be successfully previewed?

@akosyakov
Copy link
Member

It should be possible to preview local html files or pictures and so on

@i501378
Copy link
Contributor Author

i501378 commented Mar 1, 2020

@i501378 do you have an example project with a i18n.properties file so we can verify the issue? You mentioned that:

i18n.properties files cannot be viewed now

Was it ever the case that the file could be successfully previewed?

i18n.zip

it supported on vscode with extension Unique Identifier: "auchenberg.vscode-browser-preview"

@akosyakov
Copy link
Member

@i501378 You can use auchenberg.vscode-browser-preview with Theia as well.

@i501378
Copy link
Contributor Author

i501378 commented Mar 10, 2020

The i18n.properties cannot be fetched, that means any html using i18n.properties will not work as expected.
The issue may be reproduced by the below steps:
test.zip
upload the file and unzip it into the root of workspace.
execute command "Preview: Open URL", and input the "test/test.html" url
in the shown card, we will find the "TITLE" and "SUBTITLE" are not replaced by the related translation texts.

The cause to this bug is that we don't get the content from the defaultHandler() response when file type is not exists at mime-db.
If the response at this scenario will send the content too this issue will be fixed.
@akosyakov what do you this about this solution?

@akosyakov
Copy link
Member

akosyakov commented Mar 10, 2020

is not exists at mime-db. If the response at this scenario will send the content too this issue will be fixed.

cc @kittaakos maybe you know how to support other mime types

(fyi) for webviews we fall back to application/octet-stream:

mime: mime.getType(normalizedUri.path.toString()) || 'application/octet-stream',

@i501378
Copy link
Contributor Author

i501378 commented Mar 17, 2020

@kittaakos can you update?

@kittaakos
Copy link
Contributor

We need to view the files by calling the command "Preview: Open URL"

Can you explain why do you want to preview a *.properties file in the Preview?

2. execute command "Preview: Open URL", and input the url as file:///workspace/theia/i18n.properties

How often do you open such file in your favorite browser?

@i501378
Copy link
Contributor Author

i501378 commented Mar 17, 2020

Please see the use case below:

The i18n.properties cannot be fetched, that means any html using i18n.properties will not work as expected.
The issue may be reproduced by the below steps:
test.zip
upload the file and unzip it into the root of workspace.
execute command "Preview: Open URL", and input the "test/test.html" url
in the shown card, we will find the "TITLE" and "SUBTITLE" are not replaced by the related translation text.

@kittaakos
Copy link
Contributor

@i501378, do you have your own Theia extension?

@i501378
Copy link
Contributor Author

i501378 commented Mar 17, 2020

yes, but i checked it without extensions

@kittaakos
Copy link
Contributor

yes,

Super, for the time being, you can fix it on your side by customing the code you have mentioned 👇

If the response at this scenario will send the content too this issue will be fixed.

PRs are welcome! Feel free to create one if you think this is a bug and should behave differently. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application help wanted issues meant to be picked up, require help mini-browser issues related to the mini-browser
Projects
None yet
4 participants