audiobookshelf
audiobookshelf copied to clipboard
[Enhancement]: Server generated strings to be localized
Type of Enhancement
None
Describe the Feature/Enhancement
Client strings are able to be translated, but strings generated by the server are not able to be translated right now. This was originally mentioned in https://github.com/advplyr/audiobookshelf/issues/3242 under point 5, where the Tasks are not translated.
Currently, Weblate is only looking at the string resource in client/strings/. We can add the localization for the client include these strings for the server, but having the server reference a resource file as ../client/strings feels a little clunky. Not sure what the best way to handle that is.
Why would this be helpful?
Ability to localize tasks and other server generated strings.
Future Implementation (Screenshot)
N/A
Audiobookshelf Server Version
v2.12.3
Current Implementation (Screenshot)
Task strings are generated by the server
Since the client is where users are selecting their language (besides the server default language) the translation should remain client side.
The way I solved this for the home page shelves is with an additional labelStringKey for each shelf and that key maps to a string in client/strings/...
3rd party clients can optionally continue using the english only label or localize.
https://github.com/advplyr/audiobookshelf/blob/27b3a4414726a6a2778fb19e6038ce3ac1195aee/server/models/LibraryItem.js#L622-L629
It won't be exactly the same for these task descriptions since they also include a variable in the string, but a similar solution can be used.
Ah, great. Yeah, I specifically mean things like the watcher where it's hard coded, but something like you shared for the shelves should work.
https://github.com/advplyr/audiobookshelf/blob/27b3a4414726a6a2778fb19e6038ce3ac1195aee/server/Watcher.js#L287
All the tasks made with the TaskManager are hard coded so whatever solution we come up with should work for all tasks and be an update to the Task object.
Fixed in v2.14.0.