I have a use case where I’d like to store a handful of strings with static values, alongside my code that references them. The general reason for not hard coding them where they’re called, is that I’d like to make it easy for the end user to customize and modify them.

Are there any suggestions or comments about the best ways to do this? Storing them in a python file as vars seems reasonable. I’ve also considered saving them as JSON, though I don’t know if there’s any benefit to that in this case.

Thoughts are appreciated.

  • Dr. Wesker@lemmy.sdf.orgOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    It’s not, but thank you for the thoughtful response.

    I’m building a MUD server framework. I’d like to allow some of the high level event messages easily modified, should the builders/admins desire to have a totally customized experience.

    • o11c
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Honestly you probably should think about how to translate them. Python at least rolls its own .mo parser so it can support multiple languages in a single process; it’s much more difficult in C unless you push it to the clients (which requires pushing the parameterization as well).

      Non-.pot-based internationalization formats are almost always braindead and should be avoided.