Suggested feature: Translations and "closure" post in Spanish #375
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I love this project.
As I am interested that more people can read this and continue learning, I would like to make the contribution of adding different translations.
I have added first a copy of the
get-posts.js
function calledget-posts-multilang.js
, which receives a "lang" argument, which is a string that would be the ISO code of each language. In this case, as the first translation language I have used "es" (Spanish).Example:
getPostsMultilang('es')
Second, I have added a new route:
/pages/[slug]/es.js
At the same time, I've created a folder inside the
posts
folder called/es
, where I've added the post closure in Spanish.In the
/pages/[slug]/es.js
path in thegetStaticProps
function i added more props lang and langList, which will be used in a component similar to "overreacted.io" from the available translations.Something similar on the original route
/pages/[slug].js
for the same reason mentioned above.Finally, I want to mention that I didn't want to add the language path to the beginning of the "concept" (.is/es/[slug]), why?
Because it would break the beauty of the Domain used and the concept of the blog. (
whatthefuck.is/[slug]
)..... (whatthefuck.is/es/[slug]
) ... (whatthefuck.is/pt/[slug]
)No!
(
whatthefuck.is/[slug]/es
)... (whatthefuck.is/[slug]/pt
) etc.That would be my contribution.
I hope it is useful.
I intend to continue translating the other posts, if this PR is approved.