Find all the languages available for X?

From Alistair Mann / csi18n
Jump to: navigation, search

Let's say you have a page or app using lots of translations - how do you find all the languages used?

There's no single request for the answer, but you can obtain the answer with some work: make successive requests with an Accept-Language of */*, and as the answer comes back, send the request again this time asking for the previous answer to be excluded.

  • Ask for *, get back an answer with en.
  • Ask for *, en;q=0, get back an answer with pt
  • Ask for *, en;q=0, pt;q=0, get back a 404 answer.
  • Thus, the languages available are English (en) and Portuguese (pt).