ClashSAN / webui-localization-la_LA

0 stars 0 forks source link

Where do we add our localization file now? #5

Open M-art-ucci opened 1 year ago

M-art-ucci commented 1 year ago

Sorry if this is a stupid question, but how do we add our localization files to the UI?

We need to create an extension for it?

ClashSAN commented 1 year ago

@M-art-ucci Yes, the method was changed, you have to make a repository. Others have made repositories like this: https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN https://github.com/Harvester62/stable-diffusion-webui-localization-it_IT

If you have more questions, please ask, I'm here to help.

xmodar commented 1 year ago

I might add here that after you get your repo ready, it should be listed in the extensions index.

M-art-ucci commented 1 year ago

Thanks!

I created it here: https://github.com/M-art-ucci/stable-diffusion-webui-localization-pt_BR

Now what is the next step? Just add to the extensions index?

Like this? "tags": ["localization"] }, { "name": "pt_BR Localization", "url": "https://github.com/M-art-ucci/stable-diffusion-webui-localization-pt_BR", "description": "brazillian portuguese localization", "tags": ["localization"] },"

I don't want to mess the extensions index by doing something wrong =x

M-art-ucci commented 1 year ago

Question 2: is there a way to localize others extensions or it's up to each one who created it? For instance, to localize Dreambooth.

xmodar commented 1 year ago

Thanks!

I created it here: https://github.com/M-art-ucci/stable-diffusion-webui-localization-pt_BR

Now what is the next step? Just add to the extensions index?

Like this? "tags": ["localization"] }, { "name": "pt_BR Localization", "url": "https://github.com/M-art-ucci/stable-diffusion-webui-localization-pt_BR", "description": "brazillian portuguese localization", "tags": ["localization"] },"

I don't want to mess the extensions index by doing something wrong =x

When you click on the edit button, it will format the JSON and it will be much easier to edit:

{
    "name": "pt_BR Localization",
    "url": "https://github.com/M-art-ucci/stable-diffusion-webui-localization-pt_BR",
    "description": "Brazillian portuguese localization",
    "tags": ["localization"]
}

Just be careful and don't forget about the commas. The last item mustn't have a dangling comma. If you are uncertain, you can use this tool to verify your changes just to be sure.

Question 2: is there a way to localize others extensions or it's up to each one who created it? For instance, to localize Dreambooth.

Of course, install the extension that you want to localize, then download the localization file as you did in the beginning. You will notice the new untranslated text was added to the file. Update those in your localization file and you should be good to go. To the best of my knowledge, the most comprehensive localization file out there is the Italian localization (thanks to the huge efforts of @Harvester62).

M-art-ucci commented 1 year ago

After breaking extensions index a few times, I was able to do it... sorry for the mess and thank you guys!

M-art-ucci commented 1 year ago

Just to get it right: every extension I localize I just add it to my pt_BR file, right?

ClashSAN commented 1 year ago

@M-art-ucci hi, you just edit your pt_BR.json file, nothing else

ClashSAN commented 1 year ago

After breaking extensions index a few times, I was able to do it... sorry for the mess and thank you guys!

@M-art-ucci good thing you fixed quickly 😅

Harvester62 commented 1 year ago

Thank you @xmodar for the appreciation about my translation work on the Italian localization. I wish to provide some information about the procedure I follow to update the localization file. My local system is an Asus ROG G752vs notebook with Intel(R) Core(TM) i7-6820HK CPU @ 2.70GHz, 32GB RAM, Nvidia GTX 1070 8GB VRAM, Nvidia Studio Drivers 522.30, CUDA Toolkit 11.8, Windows 10 Pro, 21H1, build 19043.2251.

1) First of all I set the Localization Language to None in the config.json file in the root directory of the Web UI application (I am on Windows and the root directory is C:\stable-diffusion-webui) before running the webui-user.bat file, so to be sure that the UI is in English language;

2) Then I run the webui-user.bat file which has the git pull command and all the needed command line arguments for all the Scripts and Extensions i have installed, see below:

@echo off

set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS=--xformers --opt-split-attention --disable-safe-unpickle --api --deepdanbooru --allow-code --administrator --medvram git pull call webui.bat

3) If there aren't any errors or Traceback messages, which requires to be fixed otherwise some Script or Extension won't work and won't be displayed in the Web UI, I start the Web UI at the given URL (usually it should be https://127.0.0.1:7860);

4) Once in the Web UI, I go to the Extensions|Available tab and I check if there are new Extensions (some Scripts are currently being ported to Extensions, and in the case I find one of them, I delete the script in the ...\scripts folders otherwise it may take the precedence to the Extension version); if new Extensions are listed I install them, then I close both the Web UI and the webui-user.bat console to restart from scratch (the reason is that everytime I do it from the Web UI the VRAM increases by double and after a few restarts the VRAM is full, possibly a bug of some Extensions that doesn't free the memory, I will have to investigate and eventually open a bug report);

5) Then, after the Web UI has restarted, I go to the Extensions|Available tab to refresh the Extensions list, switch to the Extensions|Installed tab and check for Updates; if there are some marked as "behind" I "manually" git pull for each related repository inside the C:\stable-diffusion-webui\extensions because I want to read the logs and understand if there has been any changes to the Extension's UI; in the affirmative, I take note of that extension in a text file for later reference and to include it in the commit;

6) for the reasons explained above (bad memory management), I close everything and I restart again from scratch the Web UI;

7) Now I click on, open each single tab in the UI, as well as select any loaded Script in both txt2img and img2img, as well as drop down lists and hidden options, advanced options, extra settings (in Loopback and Superimpose) to get all the labels (it might not be necessary, I don't know, but to stay safe I do all this checks);

8) finally I go to the Settings and click on the Download Localization Template button to download the localization.json file in English language. This will be the one to use for reference and to compare with my it_IT.json file (in reality I use an it_IT_ric.json file instead inside the ...\localizations folder to do not mess with the last committed localization file). I do not download any other localization files, therefore in the Settings, Localization I should see only the it_IT and it_IT_ric files, the first being the officially loaded one, and the latter being my working file.

The process now is quite simple. I open the working file it_IT_ric.json (ah, it ends in _ric because my name is Riccardo, but the important thing is to give it another name from it_IT.json) inside the Notepad++ program, and then I open the localization.json template file downloaded previously (see above), and activate the comparison/sycnronization between the two to see the differences, and start copying the missing labels from the localization.json template into the it_IT_ric.json working file. After that I start the translation process. When I've finished, I copy all the content of the working file inside the text box available at https://jsonchecker.com/ to check for any mistakes to be corrected, until the json file is fine.

Only after this last step I load the working file it_IT_ric.json in the SD Web UI from the Settings|Localization, restart the Web UI, and check if everything is working fine. If I am happy with the results (which never happens, I always give a second pass of translations because I realize that a literal translation is not clear enough, requiring to read the script or the readme file of the script/extension for a better understanding and translation) I save the working file as it_IT_vN.json (v for version N is the progressive numbering) and again as it_IT.json inside a folder I use to keep track of all versions.

Finally, I commit this it_IT.json file to the online repository.

I do not copy into the working file the list of artists of the StylePile, neither the long list of wN in the Embedding Editor because it makes no sense to translate them.

I am sorry for the long, and possibly convoluted process, but that's how I do it. Hope it helps other translators.

xmodar commented 1 year ago

This is what I was talking about. The attention to detail is impeccable and it shows. I think this comment should be referenced on the wiki for others to learn from. Step 7 is not technically required but it is a nice touch as some text will not show up in the HTML to be parsed by the buggy localization.js. The only thing I did differently for the Arabic localization is to organize the lines in the file by the order they appear in the UI. However, I didn't get to do the extensions yet and it is a bit behind. Now, the simplest thing we can do is to copy the keys from it_IT.json and reap the benefits of having such a team player with us. Keep up the good work man, it is highly appreciated and hasn't gone unnoticed!