o.i18n
v1.0.0
Published
Simple i18n library from OtagJS Community
Downloads
38
Maintainers
Readme
O.u18a ya da O.i18n
O.u18a (uluslararasılaştırma) diller arası çeviri için yalınlaştırılmış bir arabirim sunar
ES6 Bileşeni olarak kullanabileceğiniz O.u18a'yı ön uçta kullanabilirsiniz.
Node Bileşeni olarak arka uçta da kullanabilirsiniz.
Kurulum
npm i o.i18n -g
ES6 Bileşeni olarak kullanma
Örnek kullanım ./orn/frontend dizini içindedir.
Dil belgesi oluşturma
// tr.js
export default {
sayı: ['sıfır', 'bir', 'iki'],
birim: {
m : 'metre',
km: 'kilometre'
}
}
Kullanma
import u18a from 'o.i18n'
import tr from './tr.js'
//import en from './en.js'
i18n({
tr /*,en*/
})
console.log( 'sayı.0'.tr ) // sıfır
console.log( 'birim.km'.u18a('tr') ) // kilometre
NodeJS Bileşeni olarak kullanma
Örnek kullanım ./orn/backend dizini içindedir.
Dil belgesi oluşturma
// tr.js
module.exports = {
sayı: ['sıfır', 'bir', 'iki'],
birim: {
m : 'metre',
km: 'kilometre'
}
}
##### Kullanım
const u18a = require('o.i18n')
const tr = require('./tr')
//const en = require('./en')
u18a({
tr /*, en*/
})
Geleneksel kullanım biçimi
HTML belgenize ekleyin
<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.min.js"></script>
Sınama
Geliştirme ortamında sınayın
# Geliştirme bağımlılıklarını kur
npm i
# Sına
npm test
Yeterge
MIT Özgür Yazılım Yetergesi