-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ca20c0
commit c375d17
Showing
44 changed files
with
1,047 additions
and
80 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 |
---|---|---|
|
@@ -59,3 +59,4 @@ test/work | |
# Secrets | ||
githubtoken.secret | ||
googleTranslateApiKey.txt | ||
githubApiKey.txt |
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 |
---|---|---|
|
@@ -47,3 +47,4 @@ test/work | |
|
||
# Secrets | ||
googleTranslateApiKey.txt | ||
githubApiKey.txt |
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
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 |
---|---|---|
@@ -1,10 +1,16 @@ | ||
# FileAccessors | ||
An abstract mechanism to load and save files from different sources. | ||
|
||
Every file accessor has to provide a component to allow input of a file (and optionally a master file for xmb) | ||
and a service to load and save. | ||
|
||
TODO configuration component | ||
|
||
## Available file accessors | ||
### DownloadUpload | ||
The simplest file accessor. | ||
|
||
It can load files via the browser file upload mechanism and store them via browsers file download. | ||
|
||
|
||
### Github | ||
It can get translation files from a branch in a github repo and commit changes to it. |
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
...ects/tiny-translator/src/app/file-accessors/common/file-access-service-factory.service.ts
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,33 @@ | ||
import {Injectable} from '@angular/core'; | ||
import {DownloadUploadService} from '../download-upload/download-upload.service'; | ||
import {IFileAccessService} from './i-file-access-service'; | ||
import {FileAccessorType} from './file-accessor-type'; | ||
import {GithubAccessorService} from '../github/github-accessor.service'; | ||
import {IFileAccessConfiguration} from './i-file-access-configuration'; | ||
import {BackendLocalStorageService} from '../../model/backend-local-storage.service'; | ||
|
||
/** | ||
* This service returns a suitable service used to load and save a translation file. | ||
*/ | ||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class FileAccessServiceFactoryService { | ||
|
||
constructor( | ||
private downloadUploadService: DownloadUploadService, | ||
private githubAccessorService: GithubAccessorService | ||
) { } | ||
|
||
getFileAccessService(filetype: FileAccessorType): IFileAccessService { | ||
switch (filetype) { | ||
case FileAccessorType.DOWNLOAD_UPLOAD: | ||
return this.downloadUploadService; | ||
case FileAccessorType.GITHUB: | ||
return this.githubAccessorService; | ||
default: | ||
throw new Error('Unknown file type ' + filetype); | ||
} | ||
} | ||
|
||
} |
3 changes: 2 additions & 1 deletion
3
projects/tiny-translator/src/app/file-accessors/common/file-accessor-type.ts
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export enum FileAccessorType { | ||
DOWNLOAD_UPLOAD | ||
DOWNLOAD_UPLOAD = 'Browser Upload and Download', | ||
GITHUB = 'Github' | ||
} |
12 changes: 12 additions & 0 deletions
12
projects/tiny-translator/src/app/file-accessors/common/i-file-access-configuration.ts
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,12 @@ | ||
/** | ||
* A generic configuration of a file access service. | ||
* It contains informations like access tokens, directory names, etc. | ||
* The details depend on the concrete file accessor. | ||
*/ | ||
import {FileAccessorType} from './file-accessor-type'; | ||
|
||
export interface IFileAccessConfiguration { | ||
type: FileAccessorType; | ||
id?: string; // id is auto set when stored | ||
label: string; | ||
} |
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
18 changes: 18 additions & 0 deletions
18
...s/tiny-translator/src/app/file-accessors/download-upload/download-upload-configuration.ts
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,18 @@ | ||
import {IFileAccessConfiguration} from '../common/i-file-access-configuration'; | ||
import {FileAccessorType} from '../common/file-accessor-type'; | ||
|
||
export class DownloadUploadConfiguration implements IFileAccessConfiguration { | ||
|
||
static _instance = new DownloadUploadConfiguration(); | ||
|
||
readonly type = FileAccessorType.DOWNLOAD_UPLOAD; | ||
|
||
readonly label = ''; | ||
|
||
readonly id = '0'; | ||
|
||
public static singleInstance() { | ||
return this._instance; | ||
} | ||
|
||
} |
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
8 changes: 4 additions & 4 deletions
8
projects/tiny-translator/src/app/file-accessors/download-upload/downloaded-file.ts
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
Empty file.
Oops, something went wrong.