View Single Post
Old 03-04-2021, 08:48 AM   #1
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Problems with translated strings

Thers is a problem reported by BetterRed in regards to menu items in the Favourites Menu plugin. The problem is that when a user switches to a different language, the menu item text is changed to a translated string in that language, and the Favourites Menu plugin cannot find the menu item because it relies on it having the same name.

This problem would also affect the action chains plugin as it shares code with the Favourites Menu plugin. I was able to solve the problem, but only partially by using this:

Code:
paths = [paths[0]] + [_(x) for x in paths[1:]]
This only solves the problem if the user configures the Favourites Menu plugin in English and switches to another language. However, it does not help with the reverse situation when a user configures the plugin in a language other than English and then switches languages.

The solution to this, would be to get the original English untranslated string (msgid) from the translated string (msgstr), and persist the msgid in the json file instead of the msgstr. I don't know how to get the msgid from the msgstr. Is this possible? Can someone help with this or any other alternative solutions?
capink is offline   Reply With Quote