To any devs of a new Lemmy app... don't hardcode your app's strings! - eviltoast

This is applicable to almost any piece of software with text in it. When starting your new app, you should make sure you are using a separate language file for the strings in your app. This makes text reusable, and you can change it all in one place.

Once your app gains a community, if you did this, you can also get translators!

With Photon i made the massive mistake of hardcoding everything up until the app became massive, and my PR for un-hardcoding all the strings looks like this:

The amount of lines modified in the GitHub PR. 2,067 lines added, 1,082 removed.

It was worth it though! Because the community has translated it into 11 languages!

  • teolan@lemmy.world
    link
    fedilink
    arrow-up
    14
    ·
    3 months ago

    How do you deal with the fear that contribution in languages you don’t know could be malicious/offensive? This is something that would scare me when reviewing contributions adding new languages

    • Scipitie@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      4
      ·
      3 months ago

      From another project I’ve contributed as translator, not as dev:. They had set up a completely different flow, translation tool, bug reporting, deployment, etc. The dev had basically nothing to do with it,except forwarding bug reports.

      The tool landscape grew quite a bit in the last decade though, I think - pretty sure you can do the pull request / review between volunteers as well by now without issues. M