-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance: Add license, i18n, and improve settings
- Loading branch information
Showing
38 changed files
with
883 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Release Obsidian plugin | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18.x" | ||
|
||
- name: Build plugin | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
tag="${GITHUB_REF#refs/tags/}" | ||
gh release create "$tag" \ | ||
--title="$tag" \ | ||
--draft \ | ||
main.js manifest.json styles.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 luxmargos (Jinho Yun) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import en from "./trans/en"; | ||
export type Translates = typeof en; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { locale } from "moment"; | ||
import { Translates } from "./langType"; | ||
|
||
import en from "./trans/en"; | ||
import ko from "./trans/ko"; | ||
import ar from "./trans/ar"; | ||
import cz from "./trans/cz"; | ||
import da from "./trans/da"; | ||
import de from "./trans/de"; | ||
import enGB from "./trans/en-gb"; | ||
import es from "./trans/es"; | ||
import fr from "./trans/fr"; | ||
import hi from "./trans/hi"; | ||
import id from "./trans/id"; | ||
import it from "./trans/it"; | ||
import ja from "./trans/ja"; | ||
import nl from "./trans/nl"; | ||
import no from "./trans/no"; | ||
import pl from "./trans/pl"; | ||
import pt from "./trans/pt"; | ||
import ptBR from "./trans/pt-br"; | ||
import ro from "./trans/ro"; | ||
import ru from "./trans/ru"; | ||
import tr from "./trans/tr"; | ||
import zhCN from "./trans/zh-cn"; | ||
import zhTW from "./trans/zh-tw"; | ||
|
||
const allLangs: { [key: string]: Partial<Translates> } = { | ||
ar, | ||
cs: cz, | ||
da, | ||
de, | ||
en, | ||
"en-gb": enGB, | ||
es, | ||
fr, | ||
hi, | ||
id, | ||
it, | ||
ja, | ||
ko, | ||
nl, | ||
nn: no, | ||
pl, | ||
pt, | ||
"pt-br": ptBR, | ||
ro, | ||
ru, | ||
tr, | ||
"zh-cn": zhCN, | ||
"zh-tw": zhTW, | ||
}; | ||
|
||
let currentDict: Partial<Translates>; | ||
// export const setLocale = (locale: keyof Dicts) => { | ||
export const setLocale = (locale: string) => { | ||
if (locale in allLangs) { | ||
currentDict = allLangs[locale] as Translates; | ||
return; | ||
} | ||
currentDict = en; | ||
}; | ||
|
||
setLocale(locale()); | ||
|
||
export const t = (key: keyof Translates): string => { | ||
if (key in currentDict) { | ||
return currentDict[key] ?? ""; | ||
} | ||
|
||
return en[key] ?? key; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// العربية | ||
|
||
export default {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// čeština | ||
|
||
export default {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Dansk | ||
|
||
export default {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Deutsch | ||
|
||
export default {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// British English | ||
|
||
export default {}; |
Oops, something went wrong.