palant / pfp

A simple and secure browser extension to be used with KeePass databases.
https://pfp.works/
Mozilla Public License 2.0
114 stars 14 forks source link

Cannot localise element attributes #28

Closed kzar closed 8 years ago

kzar commented 8 years ago

I was having a play with the code this evening, attempting to improve the "all passwords" page interface. I wanted to add a search input text box with the placeholder text of "Search Vault". Reading online it seemed that adding a property allpasswords-search.placeholder = Search Vault would do the trick, but that resulted in the following error when Chrome attempted to load the extension:

Failed to load extension from: ~/code/easypasswords/build-chrome
Name of a key "allpasswords_search.placeholder" is invalid. Only ASCII [a-z], [A-Z], [0-9] and "_" are allowed.

So it seems there's no way to localise attributes at the moment. I guess we need to handle the attribute syntax in toChromeLocale somehow, perhaps replacing the final . with a double underscore __? Then we could add some logic to chrome/data/i18n.js to populate supported attributes.

What do you think?

palant commented 8 years ago

I don't think that it is really worth it. The SDK is going away, its conventions aren't something we should bind ourselves to. In https://github.com/palant/easypasswords/commit/d62880d77cfde323bde6768bb0c1564365764c6c I solved it by assigning the attribute dynamically, if this really becomes a common scenario we might think about more generic improvements.