Refactor multi-script name code. Update languages.

This commit is contained in:
Mike Cao 2022-04-09 22:11:15 -07:00
parent 0e82807170
commit edd1645bab
3 changed files with 11 additions and 15 deletions

View File

@ -4,15 +4,11 @@ function customScriptName(req) {
const scriptName = process.env.TRACKER_SCRIPT_NAME;
if (scriptName) {
const names = scriptName.split(',').map(name => name + '.js');
const url = req.nextUrl.clone();
const { pathname } = url;
const names = scriptName.split(',').map(name => (name + '.js').trim());
const pathNameParts = pathname.split('/');
const lastPathName = pathNameParts[pathNameParts.length - 1];
if (names.indexOf(lastPathName) !== -1) {
if (names.find(name => pathname.endsWith(name))) {
url.pathname = '/umami.js';
return NextResponse.rewrite(url);
}

View File

@ -734,7 +734,7 @@
"metrics.languages": [
{
"type": 0,
"value": "语言"
"value": "Languages"
}
],
"metrics.operating-systems": [

View File

@ -32,13 +32,13 @@
"label.all-events": [
{
"type": 0,
"value": "All events"
"value": "所有事件"
}
],
"label.all-time": [
{
"type": 0,
"value": "All time"
"value": "所有時間段"
}
],
"label.all-websites": [
@ -304,7 +304,7 @@
"label.reset-website": [
{
"type": 0,
"value": "Reset statistics"
"value": "重置統計數據"
}
],
"label.save": [
@ -428,7 +428,7 @@
"message.confirm-reset": [
{
"type": 0,
"value": "Are your sure you want to reset "
"value": "您確定要重置 "
},
{
"type": 1,
@ -436,7 +436,7 @@
},
{
"type": 0,
"value": "'s statistics?"
"value": " 的數據嗎?"
}
],
"message.copied": [
@ -564,7 +564,7 @@
"message.reset-warning": [
{
"type": 0,
"value": "All statistics for this website will be deleted, but your tracking code will remain intact."
"value": "本網站的所有統計數據將被刪除,但您的跟蹤代碼將保持不變。"
}
],
"message.save-success": [
@ -626,7 +626,7 @@
},
{
"type": 0,
"value": " 確認"
"value": " 確認删除"
}
],
"message.type-reset": [
@ -640,7 +640,7 @@
},
{
"type": 0,
"value": " 確認"
"value": " 確認删除"
}
],
"metrics.actions": [