codeforjapan / hackdays

Next version of Social Hackday website.
hackdays-c4j.vercel.app
6 stars 0 forks source link

[Story] better language selector #10

Open halsk opened 2 years ago

halsk commented 2 years ago

Goal:

As a user, I want to keep the selected language so that I can read content in my preferred language.

Tasks:

  1. Use the browser's default language when no language is selected.
  2. Keep the selected language when users switch languages.
  3. Need to decide how we can specify the language in the URL. (domain? subdir? language parameters?)
  4. Add a language setting to the user's settings.
  5. User-generated content should be auto-translated? (as a Future work)

Acceptance Criteria:

MaySoMusician commented 2 years ago
  1. Need to decide how we can specify the language in the URL. (domain? subdir? language parameters?)

The best choice will be to use query parameters. Here's why.

A URL describe where a document is located; if a URL differs from another one, these documents that the URLs refer to are different.

Assume we have a project "foobar" and have two lanuguage English and Japanese. If we separate the project pages for each language by domain level, we'll get something like en.hackdays.example/foobar and ja.hackdays.example/foobar. Or, using subdirectories, we'll get 'hackdays.example/en/foobar' and hackdays.example/ja/foobar. These two approaches will distinguish the English page and the Japanese page.

In our app, however, every language version of one project has almost same content. We shouldn't split them into multiple pages by assigning to different URLs with domains or subdirectories. Instead, just based on the single page, we can tell the server which language the users want through query parameters,

halsk commented 2 years ago

OK, let's use a query parameter to specify the language. In the future, we can create a language field in the user setting.