Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name translation route #454

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

evaporei
Copy link
Contributor

@evaporei evaporei commented Nov 5, 2017

Added new route to the project: GET /:name/:language
This solves the second item of this issue: #198

This pull request was made before and some changes were requested (#217):

The first one was solved, however the other two weren't.

About the second change requested, I got a bit confused when I read it again. Because aliases don't have translations only the real name, I want to know if a request to /dave/deu should return the translation to david

About the third change requested, I want to know were should I get the full name of a language that I only have the short name of it. Looking on the database I found these tables: 'Meanings', 'Translations' and 'Aliases'. But I did not find in any of those the information to look for a relation of languages and their shortnames.

* Updated /api/routes.js
Effectively added a new route to the express
router

* Updated /api/utils.js
Added two functions. 'findNameTranslation' that takes
a name and a language and returns the given translation
by quering on the database. 'generateNameTranslationObject'
that recieves a translation and returns an formatted object
@evaporei evaporei mentioned this pull request Nov 5, 2017
@chrisf
Copy link
Collaborator

chrisf commented Nov 6, 2017

Check out the iso-639-3 package on npm. It's already included as a dependency in package.json, so you should be able to use it to look up the short code using the iso6393 and name properties.

Line 49 shows how you can do a lookup with it

@bluzi
Copy link
Owner

bluzi commented Nov 8, 2017

Thanks @chrisf, that's correct. Hope that answers your question.

As to the alias idea - We'll sort this in another PR, for now, please just do the full-language part, and I'll merge it.

Copy link
Owner

@bluzi bluzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the existing library @chrisf suggested (https://github.com/bluzi/name-db/blob/master/test/test.js#L49) to also respond to full-language names.
That's all, I'll merge it afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants