Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Japanese locale #417

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ The following languages are currently supported:
- fr: French (Canada, France, Switzerland)
- it: Italian (Italy, Switzerland)
- ro: Romanian
- ja: Japanese

We manage the translations in Crowdin, please see <https://crowdin.com/project/stac-browser/> for details.

Expand Down
3 changes: 2 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports = {
// "fr-CH",
"it",
// "it-CH",
"ro"
"ro",
"ja"
],
apiCatalogPriority: null,
useTileLayerAsFallback: true,
Expand Down
4 changes: 4 additions & 0 deletions src/locales/ja/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"native": "日本語",
"global": "Japanese"
}
8 changes: 8 additions & 0 deletions src/locales/ja/custom.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"authConfig": {
"description": ""
},
"fields": {

}
}
51 changes: 51 additions & 0 deletions src/locales/ja/datepicker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// 1. Specify output format
const format = 'YYYY/MM/DD';

// 2A. Either re-use settings and phrases from vue2-datepicker...
const locale = import('vue2-datepicker/locale/ja');

// 2B. ... or define your own based on https://github.com/mengxiong10/vue2-datepicker
/*
const locale = {
// the locale of formatting and parsing function
formatLocale: {
// MMMM
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
// MMM
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
// dddd
weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
// ddd
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
// dd
weekdaysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
// first day of week
firstDayOfWeek: 0,
// first week contains January 1st.
firstWeekContainsDate: 1,
// format 'a', 'A'
meridiem: (h: number, _: number, isLowercase: boolean) {
const word = h < 12 ? 'AM' : 'PM';
return isLowercase ? word.toLocaleLowerCase() : word;
},
// parse ampm
meridiemParse: /[ap]\.?m?\.?/i;
// parse ampm
isPM: (input: string) {
return `${input}`.toLowerCase().charAt(0) === 'p';
}
},
// the calendar header, default formatLocale.weekdaysMin
days: [],
// the calendar months, default formatLocale.monthsShort
months: [],
// the calendar title of year
yearFormat: 'YYYY',
// the calendar title of month
monthFormat: 'MMM',
// the calendar title of month before year
monthBeforeYear: false,
}
*/

export default {format, locale};
9 changes: 9 additions & 0 deletions src/locales/ja/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Utils from '../../utils';
export default Utils.mergeDeep(
// Don't import the fields.json as it's a 1:1 mapping anyway.
// If you want to make changes to en/fields.json you can override the phrases in custom.json
// (or alternatively you can remove the '//' from the next line and edit the field.json directly).
// { fields: require('./fields.json') },
require('./texts.json'),
require('./custom.json')
);
32 changes: 32 additions & 0 deletions src/locales/ja/duration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// A. Either re-use phrases from iso-duration...
import { ja as locale } from '@musement/iso-duration';

// B. ... or define your own based on https://github.com/musement/iso-duration
/*
const locale = {
years(c) {
return "year" + (c === 1 ? "" : "s");
},
months(c) {
return "month" + (c === 1 ? "" : "s");
},
weeks(c) {
return "week" + (c === 1 ? "" : "s");
},
days(c) {
return "day" + (c === 1 ? "" : "s");
},
hours(c) {
return "hour" + (c === 1 ? "" : "s");
},
minutes(c) {
return "minute" + (c === 1 ? "" : "s");
},
seconds(c) {
return "second" + (c === 1 ? "" : "s");
},
decimal: ".",
};
*/

export default locale;
Loading