I have searched all over internet for what I figure has to be a trivial question.. How on earth do I make a basic web app without hard coding any text to it?!? This seem to be the first lesson to learn but nowhere can I find how to properly do this..
I made a web app some time ago using Google Script, back then I modified the DOM server side before serving it to client - and easily switched all text to placeholders which I could easily lookup in my database and replace with the correct wording and language -
<h1></h1>
would be served as:
<h1>My Header</h1>
if English was the desired language.. The database just kept something like
{'en': {'myHeader':'My Header', 'myOtherPhrase':'I hate computers sometimes'}, 'sv':{...}}
Now I'm trying to advance a bit from Google Script and are writing the same web app again but I can't understand where to start and/or what direction to take?
I want absolutely zero hard coded words / text.. I don't want to do 5 different sites in 5 hard coded language, and I don't want to be the only one who are able to change a misspelled word but I want to create a simple admin tool for other people who know nothing about programming take care of that themselves.
Nowhere can I find a straight answer saying THIS is how you DO it in 2017..
-
I looked up XML... that seems very outdated and old-school?
-
I checked up node.js and tried to learn.. but didn't. I can't figure out how to do things server side as before.. Besides, it seems as modifying the DOM as a string server side before serving client (templated Html in Google script) is very amateur-ish as it has absolutely zero SEO as far as I'm concerned of SEO.. I can't imagine this is how google would do themselves.
-
I saw a few examples where people are putting out tags then looping through the DOM to replace them client side.. Which also seem a really slow and bad idea, where the tags often are visible for a second for the user before changed (not to mention the lacking of SEO again).
-
Then I've seen a lot of examples of people hardcoding. I do not want to do that...
There just HAS to be an obvious way. Please world enlighten me...
I'm hosting my app on Firebase... Thanks!
Aucun commentaire:
Enregistrer un commentaire