Hi, folks,
For many languages which dose not use Latin characters, the URL of an articles in Wikipedia might be very long. This is the case for Chinese Wikipedia.
So in order to help people on this problem, I create a small project to solve it, and it runs successfully on my local machine. Although I dose not deploy it to a public server yet, I decided to make the code public first. You can get the code at http://github.com/mountain/shortify
It uses API call to get pageId by the title, and then convert pageId by base 36 to the short url. It is quite simple. To reduce the frequency of API call, a simple cache was used. So far, only Chinese and English were supported.
If you think your language need such kind a tool, please help me localize the i18n config file at http://github.com/mountain/shortify/blob/master/config/i18n.js
Comments are welcomed. If you can help setup a server, that would be nice and please contact me separately.
Regards,
Mingli (User:Mountain)
2010/8/3 Mingli Yuan mingli.yuan@gmail.com:
It uses API call to get pageId by the title, and then convert pageId by base 36 to the short url. It is quite simple. To reduce the frequency of API call, a simple cache was used. So far, only Chinese and English were supported.
Why would you reduce the page ID in length with base 36? They're, what, 10 digits?
Roan Kattouw (Catrope)
On 08/03/2010 05:59 PM, Mingli Yuan wrote:
It uses API call to get pageId by the title, and then convert pageId by base 36 to the short url. It is quite simple. To reduce the frequency of API call, a simple cache was used. So far, only Chinese and English were supported.
you should consider base32 http://www.crockford.com/wrmg/base32.html
j
If you think your language need such kind a tool, please help me localize the i18n config file at http://github.com/mountain/shortify/blob/master/config/i18n.js
URL has Read-Only access
On Tue, Aug 3, 2010 at 7:09 PM, j@v2v.cc wrote:
On 08/03/2010 05:59 PM, Mingli Yuan wrote:
It uses API call to get pageId by the title, and then convert pageId by
base
36 to the short url. It is quite simple. To reduce the frequency of API call, a simple cache was used. So far,
only
Chinese and English were supported.
you should consider base32 http://www.crockford.com/wrmg/base32.html
j
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Some admin actions mess up pageid (and I did some from time to time), so your idea that a page id identifies a title is buggy.
On 8/4/10, സാദിക്ക് ഖാലിദ് Sadik Khalid sadik.khalid@gmail.com wrote:
If you think your language need such kind a tool, please help me localize the i18n config file at http://github.com/mountain/shortify/blob/master/config/i18n.js
URL has Read-Only access
On Tue, Aug 3, 2010 at 7:09 PM, j@v2v.cc wrote:
On 08/03/2010 05:59 PM, Mingli Yuan wrote:
It uses API call to get pageId by the title, and then convert pageId by
base
36 to the short url. It is quite simple. To reduce the frequency of API call, a simple cache was used. So far,
only
Chinese and English were supported.
you should consider base32 http://www.crockford.com/wrmg/base32.html
j
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
-- സ്നേഹാന്വേഷണങ്ങളോടെ, സാദിക്ക് ഖാലിദ് _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Why would you reduce the page ID in length with base 36? They're, what, 10
digits?
Roan Kattouw (Catrope)
Hi, Roan, base 36 encoding/decoding is very cheap in Javascript, just call
* parseInt(string, radix) * number.toString(radix)
Where radix is range from 2 to 36. You know, combining 0~9 and a ~z, we get 36 letters.
you should consider base32 j
base 36 is more compact than base 32.
URL has Read-Only access Sadik Khalid
Hi, Sadik,
I use github to manage the versions of my code. You can send me the code directly via mail, and I will merge it to the code. Thanks.
Some admin actions mess up pageid (and I did some from time to time), so your idea that a page id identifies a title is buggy. Liangent
Hi, Liangent,
Thanks for you response. How dose admin actions mess up pageid? Could you give me some example, so I would try to find a way to avoid it.
On Tue, Aug 3, 2010 at 11:59 PM, Mingli Yuan mingli.yuan@gmail.com wrote:
Hi, folks,
For many languages which dose not use Latin characters, the URL of an articles in Wikipedia might be very long. This is the case for Chinese Wikipedia.
So in order to help people on this problem, I create a small project to solve it, and it runs successfully on my local machine. Although I dose not deploy it to a public server yet, I decided to make the code public first. You can get the code at http://github.com/mountain/shortify
It uses API call to get pageId by the title, and then convert pageId by base 36 to the short url. It is quite simple. To reduce the frequency of API call, a simple cache was used. So far, only Chinese and English were supported.
If you think your language need such kind a tool, please help me localize the i18n config file at http://github.com/mountain/shortify/blob/master/config/i18n.js
Comments are welcomed. If you can help setup a server, that would be nice and please contact me separately.
Regards,
Mingli (User:Mountain)
Mingli Yuan wrote:
Thanks for you response. How dose admin actions mess up pageid? Could you give me some example, so I would try to find a way to avoid it.
If an admin deletes and then undeletes a page, the old page ID is not retained.
MZMcBride
On 8/4/10, Mingli Yuan mingli.yuan@gmail.com wrote:
Thanks for you response. How dose admin actions mess up pageid? Could you give me some example, so I would try to find a way to avoid it.
Deletions and restorations. They're often used to deal with mixed history (eg. results of c&p move).
Now a test server was setup and 5 languages are supported
* http://ultrafilter.org:8080/s/cs * http://ultrafilter.org:8080/s/en * http://ultrafilter.org:8080/s/he * http://ultrafilter.org:8080/s/ml * http://ultrafilter.org:8080/s/zh
Thanks for people's contribution to localize this small software:
* mountain: Chinese language * svick: Czech language * mountain and Casey: English language * amire80: Hebrew language * Sadik Khalid: Malayalam language
If you want to localize more language, please take a look of the file
http://github.com/mountain/shortify/blob/master/config/i18n.js
Clone and patch to me on github, or send me the patch directly via mail. http://github.com/mountain/shortify
Thanks.
On Thu, Aug 5, 2010 at 8:57 AM, Mingli Yuan mingli.yuan@gmail.com wrote:
Now a test server was setup and 5 languages are supported
There is '&n' at top left corner of the screen
Working
* http://ultrafilter.org:8080/s/he
Working
* http://ultrafilter.org:8080/s/ml
Not working
There is '&nbs' at top left corner of the screen
On 8/5/10, Mingli Yuan mingli.yuan@gmail.com wrote:
Now a test server was setup and 5 languages are supported
Special characters are not escaped. Try "&" in the box.
Thanks Liangent and Sadik.
Since this list is not the place to discuss bugs, please send your findings at below link
http://github.com/mountain/shortify/issues
http://github.com/mountain/shortify/issuesThanks very much.
On Thu, Aug 5, 2010 at 1:57 PM, Mingli Yuan mingli.yuan@gmail.com wrote:
Now a test server was setup and 5 languages are supported
- http://ultrafilter.org:8080/s/cs
- http://ultrafilter.org:8080/s/en
- http://ultrafilter.org:8080/s/he
- http://ultrafilter.org:8080/s/ml
- http://ultrafilter.org:8080/s/zh
Thanks for people's contribution to localize this small software:
- mountain: Chinese language
- svick: Czech language
- mountain and Casey: English language
- amire80: Hebrew language
- Sadik Khalid: Malayalam language
If you want to localize more language, please take a look of the file
http://github.com/mountain/shortify/blob/master/config/i18n.js
Clone and patch to me on github, or send me the patch directly via mail. http://github.com/mountain/shortify
Thanks.
wikitech-l@lists.wikimedia.org