Loading translation files into /usr/local/emhttp/languages


Recommended Posts

I've been working on adding localization to the Tailscale plugin, but ran across a weird behavior with Community Apps / language pack installation and would like to understand how to make this work best.

 

Per the multi-language design guide, "The translation text file(s) which comes with a plugin needs to be manually stored in the corresponding language sub-directory." I know that some plugins have their translations included in the Unraid language pack itself, but I would prefer to keep translations in my repository.

 

Based on the the design guide, I tried adding /usr/local/emhttp/languages/es_ES/tailscale.txt to my package. This works fine for loading the translations, but has a problematic side effect: it causes CA to believe that the entire language pack is installed (presumably CA is detecting the presence of the es_ES folder instead of the file in /boot/config/plugins). As a result, the language pack cannot be completely installed if a user wants to do to after installing the plugin.

 

Are language packs guaranteed to install before plugins? If so, I could rely on detecting the presence of the language folders and only load my translation if it already exists. This creates a small sequencing bug (if someone installed the language pack after the plugin, the plugin translations wouldn't be loaded until after the next reboot), but that might be something I could live with.

 

Alternately, I have a cron job that I could have "monitor" for language folders and copy the translations in, but that's a very ugly solution to the problem that I'd prefer not to use.

 

Or is there another solution that I'm missing?

Link to comment

Yes CA thinks that it's installed due to the folder existing

 

What you should be doing is submitting the base english files here: https://github.com/unraid/lang-en_US

 

And then you can also include the Spanish translations here https://github.com/unraid/lang-es_ES

 

That way the base translations will propagate to all the languages for someone to (hopefully) translate, and your Spanish ones will be there on the next update of the languages

Link to comment

Ultimately, my goal was to keep the localization files inside the repositories for the plugin; I have existing tools / workflows for localization projects which I'd like to keep using :).

 

Now I know that my original approach won't work as cleanly as I would have liked it to, but I have a plan B that will work nicely for me.

 

Thanks for the info!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.