Skip to content

Instantly share code, notes, and snippets.

@sunvisor
Last active February 10, 2016 08:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save sunvisor/3726024 to your computer and use it in GitHub Desktop.
Save sunvisor/3726024 to your computer and use it in GitHub Desktop.
Japanese locale file for Sencha Touch 2
/**
* Japanese locale file for Sencha Touch 2
* File: ext-lang-ja.js
* Auther: sunvisor/Xenophy (hisashi.nakamura@xenophy.com)
* history: 2012-09-15 Prototype Version (test is not completed)
**/
Ext.onReady(function() {
var cm = Ext.ClassManager,
exists = Ext.Function.bind(cm.get, cm);
/**
* Ext.Data Class
**/
if (Ext.Date) {
Ext.Date.monthNames = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
Ext.Date.getShortMonthName = function(month) {
return "" + (month + 1);
};
Ext.Date.monthNumbers = {
"1月": 0,
"2月": 1,
"3月": 2,
"4月": 3,
"5月": 4,
"6月": 5,
"7月": 6,
"8月": 7,
"9月": 8,
"10月": 9,
"11月": 10,
"12月": 11,
"1": 0,
"2": 1,
"3": 2,
"4": 3,
"5": 4,
"6": 5,
"7": 6,
"8": 7,
"9": 8,
"10": 9,
"11": 10,
"12": 11
};
Ext.Date.getMonthNumber = function(name) {
return Ext.Date.monthNumbers[name.substring(0, name.length - 1)];
};
Ext.Date.dayNames = ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"];
Ext.Date.getShortDayName = function(day) {
return Ext.Date.dayNames[day].substring(0, 1);
};
// 小文字 a の時だけ日本語表記に、Aの時は AM, PM のまま
Ext.Date.formatCodes.a = "(this.getHours() < 12 ? '午前' : '午後')";
}
/**
* defaultDateFormat
**/
if (exists('Ext.util.Format')) {
Ext.apply(Ext.util.Format, {
defaultDateFormat: 'Y/m/d'
});
}
/**
* Picker
**/
Ext.define("Ext.locale.ja.picker.Picker", {
override: "Ext.picker.Picker",
config: {
doneButton: {text: '完了'},
cancelButton: {text: 'キャンセル'}
}
});
/**
* DatePicker
**/
Ext.define("Ext.locale.ja.picker.Date", {
override: "Ext.picker.Date",
config: {
doneButton: {text: '完了'},
monthText: '月',
dayText: '日',
yearText: '年',
slotOrder: ['year', 'month', 'day']
},
createSlot: function(name, days, months, years) {
switch (name) {
case 'year':
return {
name: 'year',
align: 'center',
data: years,
title: this.getYearText(),
flex: 3
};
case 'month':
return {
name: name,
align: 'center',
data: months,
title: this.getMonthText(),
flex: 2
};
case 'day':
return {
name: 'day',
align: 'center',
data: days,
title: this.getDayText(),
flex: 2
};
}
}
});
/**
* MessageBox
**/
Ext.define('Ext.locale.ja.MessageBox', {
override: 'Ext.MessageBox',
statics: {
OK : {text: 'OK', itemId: 'ok', ui: 'action'},
YES : {text: 'はい', itemId: 'yes', ui: 'action'},
NO : {text: 'いいえ', itemId: 'no'},
CANCEL: {text: 'キャンセル', itemId: 'cancel'},
OKCANCEL: [
{text: 'キャンセル', itemId: 'cancel'},
{text: 'OK', itemId: 'ok', ui : 'action'}
],
YESNOCANCEL: [
{text: 'キャンセル', itemId: 'cancel'},
{text: 'いいえ', itemId: 'no'},
{text: 'はい', itemId: 'yes', ui: 'action'}
],
YESNO: [
{text: 'いいえ', itemId: 'no'},
{text: 'はい', itemId: 'yes', ui: 'action'}
]
}
});
/**
* DataView
**/
Ext.define('Ext.locale.ja.dataview.DataView', {
override: 'Ext.dataview.DataView',
config: {
loadingText: '読み込み中...'
}
});
/**
* NestedList
*/
Ext.define('Ext.locale.ja.dataview.NestedList', {
override: 'Ext.dataview.NestedList',
config: {
loadingText: '読み込み中...',
emptyText: 'これ以上ありません',
backText: '戻る'
}
});
/**
* NavigationView
**/
Ext.define('Ext.locale.ja.navigation.Bar', {
override: 'Ext.navigation.Bar',
config: {
defaultBackButtonText: '戻る'
}
});
/**
* ListPaging plugin
**/
Ext.define('Ext.locale.ja.plugin.ListPaging', {
override: 'Ext.plugin.ListPaging',
config: {
loadMoreText: '続きを読む...',
noMoreRecordsText: 'これ以上ありません'
}
});
/**
* PullRefresh plugin
**/
Ext.define('Ext.locale.ja.plugin.PullRefresh', {
override: 'Ext.plugin.PullRefresh',
config: {
pullRefreshText: '下に引いて更新...',
releaseRefreshText: '離して更新...',
loadingText: '読み込み中...'
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment