elgatosf / streamdeck-plugin-template

A starting place for a new JavaScript Stream Deck plugin.
MIT License
180 stars 69 forks source link

Translations not working at all #3

Closed x7bit closed 1 year ago

x7bit commented 1 year ago

The 'Localization' key/section inside the localization json doesn't work. This worked with the old pi-samples libraries, but not with the new ones.

{
 ....
  "Localization": {
    "More info": "More info",
    "Message": "Message",
    "Click Me": "Click Me",
    "Button": "Button"
  }
}
tiptronic commented 1 year ago

@x7bit I added a localization script - but the snippet you posted won't do anything, because nothing changed from source (left) to target (right).

x7bit commented 1 year ago

Sorry @tiptronic, I think I didn't explain myself clearly enough. I put a complete json, specifically in spanish (es.json):

{
  "Description": "Usa esto para crear tu propio plugin", 
  "Name": "Stream Deck Template", 
  "Category": "Templates", 
  "com.elgato.template.action": {
    "Name": "Action", 
    "Tooltip": "Esto es sólo el action de este plugin"
  },
  "Localization": {
    "More info": "Más info",
    "Message": "Mensaje",
    "Click Me": "Púlsame",
    "Button": "Botón"
  }
}

Description and Tooltip are are translated correctly, but all elements of Localization (More info, Message, Click Me, Button) are not (that correspond to HTML elements with 'data-localize').

tiptronic commented 1 year ago
CleanShot_2023-01-31_20 31 34

Not sure what you mean... I just copied your strings into an es.json and set my machine's language to spanish - and it works just fine... (using the script provided - that doesn't even need the data-localize tag to work).

As far as the data-localize tag is concerned, I'll take another look tomorrow...

x7bit commented 1 year ago

Sorry @tiptronic, my fault. In the inspector.js there is a comment that says:

/**
 * Provide window level functions to use in the external window
 * (this can be removed if the external window is not used)
 */

I thought that from there on down I could delete everything since my plugin has no external windows, and I had not noticed that the localization functions are at the bottom. I also thought that the form localization was something inherent to the library. Anyway, sorry for the misunderstanding.

tiptronic commented 1 year ago

@x7bit np - we're working on something much better... so just keep your [data-localize] attributes intact and standby a little ;)

x7bit commented 1 year ago

Thank you @tiptronic, I will stay tuned!