You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First outlined by @nickcrisci in a very well-thought-out and great contribution PR #206
I wanted to define a little bit how this change works and outline some of its improvements in an issue.
What this does
makes it so all you need is to create the new src/models/localization/ with some additional fields, and no longer need to edit /middleware or other files to configure accepting the new languages.
the accepted languages update based on the files in the folder, allowing quicker contributions and ease of development.
Adds a short configurable field at the top of the facts file which specifies our agreed on conventions for querying it in the I18N codes we use.
In this example, we add a new language file for Canadian English.
It would be src/models/localization/eng-ca.js and look like
constfacts=["Cats have been the most popular pet for families in Canada since data was first collected in 1987.","..."];constlangName="English",// normally this is the language namelangISO="eng",langLocale="ca",langLocaleName="Canadian";module.exports={
langName,
langISO,
langLocale,
langLocaleName,code: `${langISO}-${langLocale}`,codeName: `${langName} (${langLocaleName})`,facts: facts,};
If you query the api with eng-ca language parameter you will get the facts appearing more for the tailored localization in the language of english.
Feel free to change the facts to be more meaningful to the location you want, as the original english facts are with america in mind, I would love to see what other places have for accurate and high quality facts about cats.
add additional documentation to the README.md listing the languages
create a new issue to demonstrate how a new language could be added, as well as making a few other issues more concise and specific for their contributions with less additional work in middleware/routing.
The text was updated successfully, but these errors were encountered:
First outlined by @nickcrisci in a very well-thought-out and great contribution PR #206
I wanted to define a little bit how this change works and outline some of its improvements in an issue.
What this does
src/models/localization/
with some additional fields, and no longer need to edit/middleware
or other files to configure accepting the new languages.How this is done
[TO-DO] @BeauBouchard CC @switchhalt [fill this part out in more detail]
We want to adhere to the Standards for Content-Language and Accept-Language going forward.
Adds a short configurable field at the top of the
facts
file which specifies our agreed on conventions for querying it in the I18N codes we use.In this example, we add a new language file for
Canadian English
.It would be
src/models/localization/eng-ca.js
and look likeIf you query the api with
eng-ca
language parameter you will get the facts appearing more for the tailored localization in the language of english.Feel free to change the facts to be more meaningful to the location you want, as the original english facts are with america in mind, I would love to see what other places have for accurate and high quality facts about cats.
Work
The text was updated successfully, but these errors were encountered: