So, recently I have been trying to implement locale handling. It's quite hard, and I still cannot deploy it because of some TypeScript-specific issues. I think choosing TypeScript from the beginning was not the smartest choice. One of the first problems was actually really simple once I noticed it. Let me explain: at first, I was trying to build a tool suite, meaning many tools under my URL. I realized this would get complicated and decided to focus only on the PDF converter, but I already had the routing set up with /compressor, so I hardcoded a redirect to /compressor. This meant that if you went to my URL, it would redirect you to /compressor. But now, with language locales, the route changed to /en/compressor, and /compressor resulted in a "404 - not found". It took me way too long to realize this...
The next step was automatic locale handling, meaning it would go straight to the language of your browser. But that was too difficult, so the simpler solution was just to use the redirect again, but this time to /en/compressor. So now the default is English, but you can still manually adjust the language via a dropdown on the website itself.
Unfortunately, my URL still points to the old webpage because I couldn't deploy the new one yet. This will be a task for next time.
Top comments (0)