Skip to content

Commit

Permalink
Merge branch 'master' of github.com:yxw007/translate
Browse files Browse the repository at this point in the history
  • Loading branch information
yxw007 committed Nov 13, 2024
2 parents b212ba9 + 4c073d0 commit 3396f5b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
# Changelog


## v0.0.13

[compare changes](https://github.com/yxw007/translate/compare/v0.0.12...v0.0.13)

### 🩹 Fixes

- No Translator export ([3f77ef9](https://github.com/yxw007/translate/commit/3f77ef9))

### ❤️ Contributors

- Potter <[email protected]>

## v0.0.12

[compare changes](https://github.com/yxw007/translate/compare/v0.0.11...v0.0.12)

### 🚀 Enhancements

- Translator can set the cache time uniformly via the constructor ([300dc02](https://github.com/yxw007/translate/commit/300dc02))
- Translator can set the cache time uniformly via the constructor ([e0a5af3](https://github.com/yxw007/translate/commit/e0a5af3))

### 🩹 Fixes

- Update translation test timeout ([5181237](https://github.com/yxw007/translate/commit/5181237))

### 📖 Documentation

- Improve document ([026ffdb](https://github.com/yxw007/translate/commit/026ffdb))

### 🏡 Chore

- Add github sponsor config ([0d6bb21](https://github.com/yxw007/translate/commit/0d6bb21))
- Add issue templates ([4e98f7c](https://github.com/yxw007/translate/commit/4e98f7c))

### ❤️ Contributors

- Potter ([@yxw007](http://github.com/yxw007))

## v0.0.11

[compare changes](https://github.com/yxw007/translate/compare/v0.0.10...v0.0.11)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yxw007/translate",
"version": "0.0.11",
"version": "0.0.13",
"description": "A simple library that supports multiple translation engines",
"author": "Potter<[email protected]>",
"homepage": "https://github.com/yxw007/translate",
Expand All @@ -21,7 +21,7 @@
"clean": "rm -rf dist",
"test": "vitest --run",
"test:coverage": "vitest --coverage --run",
"release": "pnpm changelogen --release -i --prerelease",
"release": "pnpm changelogen --release -i",
"prepare": "husky"
},
"type": "module",
Expand Down
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ const cache = new Cache();

class Translator {
private engines: Map<string, Engine>;
constructor() {
private cache_time: number;
constructor(cache_time: number = 60 * 1000) {
this.engines = new Map<string, Engine>();
this.cache_time = cache_time;
}
use(engine: Engine) {
if (this.engines.has(engine.name)) {
Expand Down Expand Up @@ -68,7 +70,8 @@ const translator = new Translator();
export default {
engines,
translator,
Translator,
Cache,
getLanguage,
};
export { engines, translator, Cache, getLanguage };
export { engines, translator, Translator, Cache, getLanguage };

0 comments on commit 3396f5b

Please sign in to comment.