• 3 Posts
  • 25 Comments
Joined 2 years ago
cake
Cake day: June 15th, 2023

help-circle
  • the translations on the database are for entities on the db

    Oh, then you could consider having one extra table per entity (one-to-many) with the translatable stuff:

    create table some_entity (
        id .. primary key,
        -- fields for attributes that are not translated
        price ..,
        created_on ..,
        deleted_on ..,
        ..
    );
    create table some_entity_i18n(
        id .. primary key,
        some_entity_id .. foreign key references some_entity(id),
        locale ..,
        -- one field per translatable attribute
        title ..,
        description ..,
        ..
    );
    

    IMHO putting everything in one big table will only complicate things in the long run.


  • INSERT INTO TextContent (OriginalText, OriginalLanguage)
    VALUES ("Ciao", "it");
    

    Shouldn’t that be TextContent(TextContentId, OriginalText)? Something like

    (then you should make the id a primary key, index originaltext and make the id in the other table a foreign key)

    I could drop TextContent too, and just have a Translations table with TextContentId

    Sure, but the you would have to reference the text via TextContentId in your code, which would be very annoying.

    Instead you could have a function, say t("Ciao") that kinda runs something like (of course loading all the translations in ram at startup and referencing that would be better than running a query for each and every string).

    select t.translation
      from textcontent tc
           join translations t on t.textcontentid = tc.textcontentid
     where tc.originaltext = ?
       and t.language = ?
    

    The function could also return the originaltext and log an error message if a translation is not found.

    BTW 1: most frameworks/languages have i18n facilities/libraries - you may investigate one and use it instead of rolling your own.

    BTW 2: why would you put the translations in a database? what’s the advantage compared to files?





  • Not sure if others already said this (I seem to see mostly comments explaining how to do it, but didn’t read them all), but, while it’s certainly feasible, you may not want to do that.

    A router is the cornerstone of your network (if it goes down, so does the network) and if you are a self-hoster you’ll probably fiddle endlessly with your home server, and of course break it from time to time… the two things just don’t go well together.

    Personally, I’d recommend getting some second-hand router appliance that can run openwrt and use that (make sure to check the flashing procedure before deciding what to buy - some are easier than others). Or you could get a dedicated x86 machine… probably overkill though.








  • TLDR:

    What the author baptizes “do-nothing scripts” are interactive scripts that print out the steps of some procedure one by one and wait for you to confirm each step (eg. “1. do this. press enter when done” “2. do something else. press enter when done” and so forth).

    PS:

    @OP (if you are the author)

    I HATE those sites where popups come up when you are halfway reading something.

    What’s the idea behind it, besides annoying your users as much as possible?








  • Your system will appeal to the intersection between people who like gambling and people who like donating to charities.

    Even among them, I don’t see why anyone would prefer putting 100$ in your web3 thingie instead of just donating 50$, gambling with 45$, and buying a beer with the 5$ they would lose to you… well, there are a lot of stupid peculiar people (especially among crypto bros), so you might actually be ok.

    About the implementation, the 50% to charities should be transferred automatically… what’s the point of a smart contract if people must trust you to “check the total donations and create a donation on The Giving Block”?

    PS:

    IDK about the US, but where I live gambling is regulated very strictly: make sure to double check with a lawyer before getting into trouble.


  • talkingpumpkin@lemmy.worldtoSelfhosted@lemmy.worldBest phone sync
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    1 year ago

    2 more cents :)

    I’ve been using syncthing for a while now, on different devices, and the only unreliability I’ve run into is with android killing syncthing to save battery life, which is kinda hilarious, considering all the vendor- and google-provided crap they happily waste battery on (I don’t use it, but for what I’ve heard iOS is even worse in this regard).

    Specifically, I have a samsung tablet where, no matter how much I tinkered with system settings, synchthing would only run if I manually launched the app or while the tablet was charging (BTW I still use that same tablet, but it now runs LineageOS and syncthing works flawlessly).

    All this is to say, you should probably look into system settings and research ways to convince your OS to do what it’s supposed to rather than tinkering with syncthing itself.