Localization

Hi everyone,

although I recently started from a ZERO KNOWLWDGE BASE of all JAVASCRIPT, REACT, HTML, CSS, ADOBE UXP / API / DOM my plugin is starting to take an ACCEPTABLE FORM (thanks to YOUR SUPPORT and BARRANCA’s book !) and now I begin to think about a future PUBBLICATION ON THE MARKETSHARE.

So I have now the need to localize it to Italian language, but I have no idea how to do it, …and I have some questions for you :

  1. Some suggestions on the best modules / libraries that I could use to implement localization in my react project ?

  2. Should I identify and manage the correct localization based on the choice made by the user in the plugin installation phase, or based on the “const locale = host.uiLocale” or both?

  3. Do you know if there are rules to be respected on the structure and on the names of the localization folders contained in the package to be submitted for submission and review ?

  4. Do you know if it is sufficient to localize the interactive dialogs, messages and help files or if it is also compulsory to localize the names of the photoshop layers created by the plugin ?

Thanks in advance for your kind reply, I understand that my questions are very primitive but, I repeat, I got till here starting from scratch and navigating in the dark …and now also the step of the localization somehow I have to be able to do it !

1 Like

What I personally have, is similar to this:

// locale.js

import {host} from 'uxp';

const {uiLocale} = host;
const language = uiLocale.split('_')[0];

let LanguageStrings;

try {
    LanguageStrings = require(`../locale/${language}.json`)
} catch (e) {
    LanguageStrings = require('../locale/en.json')
}

export LanguageStrings

Where locale/en.json would be:

{
  "key": {
    "localeString1": "String one",
    "localeString2": "String two"
  },
  "otherKey": "Other string"
}

And then use it in jsx files:

import {LanguageStrings} from "locale.js"

export default () => {
    return <sp-textfield placeholder={LanguageStrings.key.localeString2}>
})

That’s a very simplified example

  1. I didn’t even look for any library for something as simple as this
  2. I use resolving from Ps preferences, but You could combine both preferences and some custom languages I suppose. Maybe someone likes to use EN Ps, but prefers IT plugin :slight_smile: Up to user and you
  3. I suppose you may keep folder structure that fits your project. But it’s always better to keep things semantically separated :thinking:
  4. If user has Ps preferences set to some language and Ps by default creates layers named based on that language, then I’d implement localized layer names as well. If user uses EN Ps and other plugin language, then maybe layers are better named also EN.

I think all these bullet points are up to you. But I hope someone who’s had more experience in this would comment also :slight_smile: Maybe I’ll learn new things for my next plugin :slight_smile:

Thanks @Karmalakas , your suggestion is a very good starting point for me, even if more comments and options from other fellows are very much welcome obviously.

Is anyone tracking how many of their customers are using a plugin in a language other than English?
I never bothered to translate my plugins, because I think most people will be fine with an English interface or even prefer it.

Yes, it’s in Marketplace and has been there for a while. There’s no official approach how localisation should be implemented, so I don’t see the reason Adobe would not approve a plugin because of this.


I wouldn’t say mine are translated either :sweat_smile: I only have English strings too, just not hardcoded all over the place, but in a single JSON file :slight_smile:

Thanks @simonhenke

I will think carefully about your indication !

However, for a variety of reasons, the Italian market would be the first springboard for my plugin, and therefore I must also consider that … many Italians only eat pizza and spaghetti even when traveling abroad … and that the level of English teaching is pretty low in our schools … :sweat_smile: :joy: :joy:

I use https://react.i18next.com/ and it seems to work pretty well.

thanks @Liz , you use it within the code of an UXP plugin right ?

Right, though I haven’t actually translated anything to another language, but all the pieces are there if needed.

1 Like