npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hangul-postposition

v2.0.0

Published

Translate proper Hangul postpositions for the Korean language.

Downloads

379

Readme

Hangul Postposition

(This library is for both node.js and Web Browsers.)

Translate proper Hangul postpositions for the Korean language.

  • '을(를)' to '을' or '를'
  • '이(가)' to '이' or '가'
  • '은(는)' to '은' or '는'
  • '과(와)' to '과' or '와'
  • '아(야)' to '아' or '야'
  • '이어(여)' to '이어' or '여'
  • '이에(예)' to '이에' or '예'
  • '이었(였)' to '이었' or '였'
  • '(이)' to '이' or ''
  • '(으)로' to '으로' or '로'

For examples,

  • '사자은(는) 토끼을(를) 먹고 말은(는) 풀을(를) 먹는다.' is translated to '사자는 토끼를 먹고 말은 풀을 먹는다.'.
  • '사람과(와) 고양이과(와) 개' is translated to '사람과 고양이와 개'.
  • '배이(가) 고파요. 밥이(가) 먹고 싶어요.' is translated to '배가 고파요. 밥이 먹고 싶어요.'.
  • '둘리아(야)! 희동아(야)!' is translated to '둘리야! 희동아!'.
  • '종이이어(여)서 찢어졌다. 비닐이어(여)서 늘어났다.' is translated to '종이여서 찢어졌다. 비닐이어서 늘어났다.'.
  • '저 사람 김태균이에(예)요? 아니요. 하나카나이에(예)요.' is translated to '저 사람 김태균이에요? 아니요. 하나카나예요.'.
  • '그는 곰이었(였)으며, 동시에 호랑이이었(였)다.' is translated to '그는 곰이었으며, 동시에 호랑이였다.'.
  • '불(이)야! 소방차(이)야!' is translated to '불이야! 소방차야!'.
  • '비(이)다. 아니다. 눈(이)다.' is translated to '비다. 아니다. 눈이다.'.
  • '서울(으)로 안 가니?' is translated to '서울로 안 가니?'
  • '기차(으)로 부산(으)로 갈 것이다.' is translated to '기차로 부산으로 갈 것이다.'
  • '4과(와) 7을(를) 더하면 11(이)다.' is translated to '4와 7을 더하면 11이다.'

Install

npm install hangul-postposition

Simple Example

for Node.js:

var Hanp = require('hangul-postposition');
console.log(Hanp.translatePostpositions('사자은(는) 토끼을(를) 먹고 말은(는) 풀을(를) 먹는다.'));

for Web Browsers:

<script src="hangul-postposition.js"></script>
<script>
alert(Hanp.translatePostpositions('사자은(는) 토끼을(를) 먹고 말은(는) 풀을(를) 먹는다.'));
</script>

See more examples on test/test.js

With express and i18n

You can use i18n or i18n-2.

app.js:

var Hanp = require('hangul-postposition');
var hanp = new Hanp();
var i18n = require('i18n');
i18n.configure({
	locales: ['en', 'ko'],
	defaultLocale: 'en',
	directory: __dirname + '/locales'
});

...

app.use(i18n.init);	// should be used before the router
hanp.expressBind(app);

...

app.use(app.router);

locales/ko.json:

{
	"banana": "바나나",
	"I ate %s.": "나는 %s을(를) 먹었다."
}

views/eat.jade:

- var food = __('banana')
p= __('I ate %s.', food)

These become:

<p>나는 바나나를 먹었다.</p>

If you use i18n-2, call the hanp.expressBind() function after calling the I18n.expressBind() function.