killerducky / killer_mortal_gui

15 stars 8 forks source link

"Choose Mortal File" button not present #1

Closed cjeon closed 7 months ago

cjeon commented 7 months ago

Hi, just checked your awesome work today from https://mjai.ekyu.moe/.

I provided Korean translation for https://github.com/Equim-chan/mjai-reviewer. I also would like to provide Korean translation for your UI too, but I failed to run it on my local machine.

My specific problem is that when I open the index.html on my local machine, it doesn't show "Choose Mortal File" UI but rather directly falls to parseUrl which looks for data param and fails. I assume this is a JSON data, and I saw your issue https://github.com/Equim-chan/mjai-reviewer/issues/129.

So my question is, should I run the mortal locally to get the JSON to run this project (as @Equim-chan suggested) or is there any other way you recommend using?

also thank you a lot for your contribution to the Mahjong community. Happy mahjong!

cloudfish commented 7 months ago

Hi!

I am also experimenting with running this UI locally (for translation). Grepping for "Choose Mortal File" does not return a result, so perhaps this feature is not implemented or has been removed.

A json file can be obtained following these steps:

  1. Review a game in https://mjai.ekyu.moe/ using KillerDucky UI
  2. If the resulting URL is https://mjai.ekyu.moe/killerducky/?data=/report/xxx.json, open and download https://mjai.ekyu.moe/report/xxx.json

Ideally one should be able to use index.html locally by appending "?data=path/to/mjai-reviewer-output.json" to the index.html filename, but modern browser does not allow this (XHR Open a local file) for security reasons. Maybe you need to run a tiny web server to achieve this, I'm not a web developer so I couldn't think of another way. I googled a bit for this issue :-)

And it seems this UI does not provide a way to translate most strings. Only some are translatable like the yaku names, because they are included in the Tenhou English UI extension. The new strings from the UI, like "Next Error", are not translatable afaik. To make these strings translatable one need to integrate a translation tool like po4a into the page.

And a big thank you to the author of this UI :-)

killerducky commented 7 months ago

Like cloudfish says you need to run a local webserver. I use vscode which has an easy way to run a local webserver. Or you could install python and run python3 -m http.server

Thanks for offering to translate. But please wait until I can get a proper translation infrastructure setup.

killerducky commented 7 months ago

Ok I added a README.me with notes about running a local webserver.

I also updated translations.js with i18next_data. You can update this struct with translations now and the GUI will use them. Ignore everything below that struct though. I took a stab at some Korean translations, feel free to replace with better ones if I got them wrong. Or add a new language.

cjeon commented 7 months ago

Closing as the problem is resolved by the newly added README.

Some details for those who reached here: Get the json file using curl_mjai.py, pass the path relative to the project root as the data param in the url.

  1. requests module not found: Try creating a venv of your own at the project root.