Tatoeba / tatoeba2

Tatoeba is a platform whose purpose is to create a collaborative and open dataset of sentences and their translations.
https://tatoeba.org
GNU Affero General Public License v3.0
715 stars 132 forks source link

Short URL for accessing sentences by id #955

Open ckjpn opened 8 years ago

ckjpn commented 8 years ago

Create a shortcut "URL-shortener" like this ... http://tatoeba.org/2236214 ... that forwards to ... https://tatoeba.org/eng/sentences/show/2236214

This can be done by inserting the following into the .htacess file. There should be no problems since there are no URLs on tatoeba.org that have numerals immediately following the domain name.

RewriteEngine on RewriteRule ^(\d+)$ http://tatoeba.org/eng/sentences/show/$1 [R,NC]

jiru commented 8 years ago

Why?

ckjpn commented 8 years ago

It's easy to do, it's a shorter URL, and it's an easier URL to remember..

It also makes a nice-looking URL when people are quoting sentences and their sources in research papers, and perhaps even on other websites and in social media such as twitter.

Is there really any disadvantage?

Why not go ahead an put it in the .htacess file of dev.tatoeba.org and test it? I think you and others might like it.

I had it at a4esl.com and used it quite frequently with no problems. However, I've now quit using that server and just have a4esl.com forward to a4esl.org, so you cannot see it working there now.

PaulPeer commented 8 years ago

Is there really any disadvantage?

Using it will bring us to the English interface, no? So people using one of the other interfaces will have to change back every time.

ckjpn commented 8 years ago

I don't think it will. The interface is decided by cookies, I think.

Anyway, the /eng/ part of the URL in the RewriteRule can be omitted.

RewriteEngine on RewriteRule ^(\d+)$ http://tatoeba.org/sentences/show/$1 [R,NC]

Try this without the /eng/ in the URL. https://tatoeba.org/sentences/show/4710414

ckjpn commented 8 years ago

Paul,

Also, the purpose of this wouldn't be for internal links.

For example, in a research paper, a sentence could be listed this way.

Is there a bank nearby? (tatoeba.org/4710414)

(It's concise, clearly credits the source and also gives the link.)

Instead of one of these ways, ...

Is there a bank nearby? (https://tatoeba.org/sentences/show/4710414) Is there a bank nearby? (Tatoeba Corpus Sentence #4710414) Is there a bank nearby? (Tatoeba Corpus #4710414)

This would also likely be useful in blogs and social media like Twitter.

jiru commented 8 years ago

Is there really any disadvantage?

I don’t see any disadvantage. But I don’t see any substantial advantage neither, except for your personal use, because among the very, very limited number of people quoting Tatoeba in their research papers, you’d be the only one knowing one can use short links. I don’t like feeling like we’re doing things for personal use.

Also, there are literally tons of such things that could be done on Tatoeba. Why not change the color of links? Make bigger buttons? I tend to like keeping things simple and improve when there’s a substantial need. The less code, the less bugs and maintenance. There are already enough things to do on Tatoeba.

Why not go ahead an put it in the .htacess file of dev.tatoeba.org and test it?

Because the piece of code you provided works for Apache whereas we’re using nginx.

That said, if someone wants to do it, go ahead.

jiru commented 8 years ago

This would also likely be useful in blogs and social media like Twitter.

This is a more convincing argument.

One should think about where and how to make users aware of their existence, otherwise there is no point implementing this. Maybe we could somehow make use (or replace) the “Show sentence #” form.

ckjpn commented 8 years ago

Because the piece of code you provided works for Apache whereas we’re using nginx.

Perhaps this would help. http://winginx.com/en/htaccess

nginx configuration

location / { rewrite ^/(\d+)$ http://tatoeba.org/sentences/show/$1 redirect; }

halfdan commented 7 years ago

There should be a way to implement this in CakePHP's route.php