Hello!
So right now I know a little bit about HTML5, CSS3, JS5, Node.JS, BootStrap, Express, npm, MongoDB and deploying a project into Heroku (I’m switching to Amazon Web Services)
and of course there is a bunch of things I do not know yet and I was wondering since I’m going to develop my own blog (for practice), I want it to be multi-lingual.
My native language is Greek but I also speak English and I would like to have some articles on my blog, some articles are going to be available in both languages and are going to be different topics.
For example:
Some articles are going to be about:
- Raspberry Pi & Arduino => Category: Internet of Things
- CSS Framework => Web Development
- Install Linux => Operating Systems
So you get the idea, I’m going to have Categories and two Languages.
At first I thought about having different routes:
- url_of_website/en/articles/:categoryname/article._id
- url_of_website/gr/articles/:categoryname/article._id
So different routes for different Languages but then I thought.
I am going to have so much repeated stuff
Such us: style-sheets, meta tags, meta descriptions, same HTML structure and many other things
So is there a way where I can have the user to press a switch for language selection and upon language choice, the user will be able to see specific content.
However, I want to have a MongoDB for everything for example:
(pseudo-code)
- if user selected Greek:show Greek menus and Greek available content
- What about Search Engine Crawling, can a search engine, identify switch method? Because I also want my web app to appear on Search Engines and I want everything to be organized.
I’m asking all of this because I want to write a DRY program (Don’t Repeat Yourself)
It’s very important I think in programming and also as a University student I have seen very bad code, such as: x1, x2, x3, xn … x99 for calculating average class marks.
However, you don’t always have 99 students in a class and neither you need to have 99 variables
where you could write:
var numOfStudents = 15; // number of students
var totalClassScore = 0;
for (var i =0; i < numOfStudents; i++)
{
totalClassScore += prompt("Enter student score");
}
console.log("Average Class Score: " + totalClassScore/numOfStudents);
I know it is possible but I do not know the logic yet.
That’s all for now, many thanks!