Adding translations

Davide, I’m unable to reproduce your error, could you please share:

  • steps to reproduce (as simple as possible to repro the issue)
  • any file used in those steps.

Thanks

Robert

I ran a few tests: I cannot reproduce the 500 error either.
Next time I’ll try something I’ll keep tracks of my actions, so if the problem will raise again I’ll be able to provide further details.
By the way, currently I am working in a test environemnt, so the 500 error is not a real issue,

Currently the main issue is that we haven’t still been able to upload a custom translation.
Last tentative: I uploaded a client file splitted in 5 smallest files.
This is what we see in the languages section:
Schermata 2022-09-29 alle 12.10.56
We can successfully upload the ky custom language even if already there, but nothing change.

I’m working on a couple of bug fixes atm, before moving onto this ‘higher level’ issue.

  • Can’t select custom language in locale drop down
  • Translations are loaded, but in Custom Language screen it still says ‘no translations’ even though you can see the files listed in Custom Translations.

I have to fit this in between paid work and I have a very demanding high paying client atm, so please be patient.

Is your test environment a ‘dev’ install or production install?

I have seen issue with the uploading behaviour in a dev install which I’ve not been able to isolate yet.

Are you getting any errors in the logs at the time of uploading?

A standard production install seems to be more reliable.

Thank you @merefield

Not sure what you mean exactly, but I guess a production install.
I am going to provide you an admin account if you want to take a look.

Sorry, I didn’t check at the time. I took a look now and I can’t see errors related to Multilingual.

Are you able to share:

  • the language file
  • a problematic translation file?

These are the files I used to upload Macedonian:
https://drive.google.com/file/d/1JXsc331uD734_qYtrrFi7NxsIuBvKpR5/view?usp=sharing
https://drive.google.com/file/d/1fD6eyawbC_Gl-MYgHOEsMpTfvO1kdc9-/view?usp=sharing

Thanks.

After a couple of “Closed Stream” errors, I was able to upload all those files without issue, except for the 3rd one which gave a validation error

"Validation failed: The following interpolation key(s) are invalid: "username" Upload"

Can you please take a look at that one?

I’m still not sure what causes the “Closed Stream” issue (will continue to discuss with the Discourse SME and do my own research) but can confirm everything is otherwise appearing to work with uploads and data storage.

It seems that once you get a successful Upload, the uploads then continue to work and the Closed Stream error goes away. Most odd!

The Closed Stream error is apparently not influenced by the size of the file, as it can appear even with a tiny file.

The below gives you the number of translations overriding client keys for locale mk after these files are loaded (excluding file number 3):

[7] pry(main)> TranslationOverride.where(locale: "mk").count
=> 2665

NB this was on a vanilla Production instance.

image

I just renamed the files and the first line of each file to wbp. I’ve successfully uploaded the 5 files with any issue. A few days ago I tried with kk and I got this same error message. That’s weird…

That’s right, but while the tiny file in the end is correctly uploaded, I’ve never been able to upload a big file due to the Closed Stream error.

I didn’t catch if you can use the new locale after the upload of the files. In my case the language is still marked as “no translation” in Multilingual and it doesn’t appear among Discourse locales.

Yes I’m part way through looking at this.

I’m wondering if currently you must load the client files first then add the custom language second as have seen it work. Just not in reverse order.

Just tried:

  1. removed all the previous wbp uploads
  2. uploaded the client files (no errors)
  3. uploaded the custom language

It didn’t work, the locale is still not available.

OK I have a PR for a fix.

Would you mind rebuilding against branch production_fixes and let me know if it resolves your issues?

git clone https://github.com/paviliondev/discourse-multilingual -b production_fixes

I’ll then merge it if the feedback is positive.

The change has been merged already so no need to use the branch anymore. Please update and let me know.

Also, out of interest, could you please try to load the client data as one file again? Repeat until the Closed Stream error goes away. No change has been made here, but I believe the error is independent of file size, so there may be no point in you splitting up the file. This will be useful feedback.

Sorry for this late answer. Unfortunately it did not work:

  • I tried to upload a whole file: the closed stream error still appears, even if retrying multiple times
  • I uploaded 5 smaller files (no errors): I see the flag in the Languages section (this is an improvement):
    Schermata 2022-10-10 alle 15.47.56
    I still cannot find the new language in the user preferences
  • I uploaded the custom language: nothing changed

Please find today’s logs (mk and kk errors are generated when trying to remove a client file - error 500):
Schermata 2022-10-10 alle 19.34.05

Thanks for testing … at least we’ve moved forward.

I’ll take a look at the user prefs issue when I can.

Unfortunately, this is a very complex piece of code … but we’ll nail it.

btw, did you refresh the browser page after the upload?

We re-tested today, and it worked! Not sure what the problem was (maybe cache?) but we’ve been able to upload a language (ky - client file split by 5 five smaller files) and it is shown in the interface options.

The only problem is when the user pick the new language in the preferences:
Schermata 2022-10-12 alle 12.56.40

This is what we found in the logs:
Schermata 2022-10-12 alle 13.02.59

OK, very useful, getting there … this is a completely different if related issue, I’ll take a look at this.

Hi @merefield
Sorry to bother you, I know you have a lot on your plate.
I guess you didn’t have time to take a look yet…?

No time to look at this yet, unfortunately.

I have a lot of bills at home atm and have to focus on paid work.

I will look at this soon though.