Finding my way around the codebase

Disclaimer - I’m not stupid, but I am self/team-taught in C# and .NET (in other words, I know what I know because I needed to know it, and don’t know anything else). So if it looks to somebody more skilled than I that I am in way over my head please tell me!

I figured a nice safe way to dip my toes into the code would be to to something “simple” like adding a period to a sentence in the UI.

Since I don’t know what I’m doing yet I thought I’d start by working an the zip version of the code rather than official Pull Request to reduce the likelihood of me submitting something stupid.

I’ve got Duplicati.sln opened and building in VS 2017 but when I try to search for parts of the offending text (such as does not exist Create it now? or Create folder?) nothing is found.

I found Duplicati.Library.Interface.Strings and related content in Duplicati.Library.Interface but can’t seem to find this specific string - what basic thing am I misunderstanding here?

Oh, and do we want questions like this here or over at GitHub?

What extremely basic thing am I missing here?

The problem happens because the UI is a Web based UI, and all the stuff that happens there is in html/js/anuglar/css. The way it works is that the webserver (in Duplicati.Server) exposes the webroot folder. The contents of the webroot folder are not included in the Duplicati project as they are just served as files as far as Duplicati is concerned, and maintaining an up-to-date file listing in VS is slow and error-prone.

Instead, to work with the UI, you need to use your favorite web-development editor and open the webroot folder. In there you will find the strings.


Thanks for the explanation! I knew I should have used Agent Ransack to try a plain text search. :blush:

So I’ve found the language files in \Localizations\webroot, and I understand that the localization_webroot.pot is the template and the individual localization_webroot-xxxxs.po files are the various translations.

So now, unless I hear otherwise I’m assuming:

  1. All files (including the template) need to be updated with the new text (which in this case will be just adding a period and a space).
  2. The …\ngax\scripts\directives\backupEditUri.js also should be edited.
  3. The …\ngax\scripts\angular-gettext-cli_compiled_js_output.js should NOT be edited as it will get re-generated at some point.
  4. There’s something else going on (at least for me in Chrome on Windows) because there is a \n between “does not exist” and “Create it now?” in the localization files but the resulting HTML in the actual message doesn’t include it.

Just a shot in the dark here, but i’m assuming \n is just a newline and that the UI is ignoring it in that context. That would also explain why it displays as if it’s missing a period - because it was intended to be 2 sentence fragments on separate lines, instead of a small paragraph with punctuation.

No, just the .pot file should be changed, the translated .po files will be pulled by a script ( from transifex

Yes, normally a \n is a newline which is why I’m confused as to why it’s not being treated that way.

I’m so glad to hear that - 'cause my test of updating every instance resulting in a working tray icon but a dead web interface. :slight_smile:

1 Like

Well when I said

and that the UI is ignoring it in that context.

I was attempting to propose (guess at) an answer - some text renderers (depending on the UI and usage) simply ignore newlines, stripping out all extra whitespace etc. Sometimes you just need to accept and move along, in my experience :stuck_out_tongue:

The \n is not displayed in HTML, it needs to be a <br /> . The library angular-gettext is used to translated stuff, so I am not sure if the best approach is to inject some \n to <br /> automatically or if the better solution is just to change the string.

That was my working theory that I was going to test as soon as I got this darn period to show up where I want it! :grin:

OK - I managed to break my installation somehow. The initial build (no local updates) I did worked fine, but every build after that has compiled and Duplicati.GUI.TrayIcon.exe executed but I just end up with a “red-X” icon in the tray, a blank “waiting for localhost…” browser window at http://localhost:8200/index.html, and a log saying:

2017-09-14 21:57:54Z - Information: Server has started and is listening on, port 8200
2017-09-14 21:57:54Z - Information: Server has started and is listening on, port 8200

Any hints on how to go about debugging this situation?

The tray-icon also connects to the server, so unless you have a breakpoint in the code, the browser should load as well.

Could it be a firewall or a browser plugin/security that prevents it?

There shouldn’t be - my regular installs (tested both user and service) work fine. When the log says “service listening at port xxxx” I assume that is a record of the service starting and not just where the client is listening, correct?

It’s possible the service starts then dies leaving the browser window hanging - that would explain the “red-x” tray icon, right?

When I get back to it I’ll try to verify by checking the task list, event log, and port usage - if I can remember the command. :slight_smile:

Nope. The tray-icon should go away if the process dies. And the tray-icon crashes if the server does.

Thanks, port checking here I come!

Sorry for all this “on-boarding” overhead, I’m hoping to eventually be able to help out with minor fixes and hand-holding of other wanna-be developers so you can focus on the big stuff. :grin:

Success! Of sorts - by changing the .pot AND backupEditUri.js files I got the period to show in English, but in testing other languages the text I touched now ALWAYS comes up English and (as expected) updating the individual .po files doesn’t fix it.

Is the script something I run (and if so, how do I do it) or does that happen somewhere else in the flow?

IIRC, you need to run the script to build the .po files. @agrajaghh set it up, so he can correct me :slight_smile:.

1 Like

yep, there are four scripts:

  • is creating the localization.pot and localization_webroot.pot files by searching all the strings in the code
  • is uploading the .pot files to transifex, so the translators are seeing new/changed strings
  • is downloading the translated strings (.po files) from transifex
  • is compiling the localization-xx.po files into .mo files which are used on runtime for the cli texts and the localization_webroot-xx.po files into angular-gettext-cli_compiled_js_output.js which is used by the webinterface

Thanks for the script summary!

  1. These appear to be bash shell scripts so I assume I need to run them in a Linux / Unix / BSD environment - will they work in Cygwin or the Windows 10 Linux Subsystem (How to Install and Use the Linux Bash Shell on Windows 10)?
  2. Am I correct in assuming that running these is a manual step and not part of the VS Solution build?

And thanks yet-again for all the hand-holding here.

  1. Yes, they are *nix only. The subsystem should actually work.
    Alternatively, maybe look inside and see if you can replicate what they do on Windows.

  2. Yes, we (that is mostly @agrajaghh) run them once in a while to sync with transifex.