-
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.
- Loading branch information
0 parents
commit 4ffd0e9
Showing
6 changed files
with
7,445 additions
and
0 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,4 @@ | ||
node_modules | ||
.cache | ||
dist | ||
build |
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,24 @@ | ||
# Open In Browser | ||
![Made with love for Graviton](https://raw.githubusercontent.com/Graviton-Code-Editor/website/master/src/badges/made_for_graviton.svg?sanitize=true) | ||
|
||
A simple [Graviton](https://github.com/Graviton-Code-Editor/Graviton-App) plugin to open HTML/SVG/PNG files in your preferred app (normally it's the browser). | ||
It adds an item in the status bar, there you can open the file | ||
|
||
### How to install it | ||
1. Go to the [Releases Page](https://github.com/Drylotrans/OpenInBrowser/releases) | ||
2. Download the latest version | ||
3. Extract the content of the .zip file in `%appdata%/.graviton2/plugins` | ||
|
||
### Supported languages: | ||
> It will be return the English string if the Graviton's language isn't supported | ||
- **Português brasileiro** (Brazilian Portuguese) | ||
- **Deutsch** (German) | ||
- **русский** (Russian) | ||
- **Español** (Spanish) | ||
- **Français** (French) | ||
- **Català** (Catalan) | ||
- **Italiano** (Italian) | ||
- **English** | ||
|
||
If you know a language and want to contribute, do a PR with the translated strings. | ||
I'll appreciate it :heart: |
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,28 @@ | ||
export const strings = { | ||
label: { | ||
brazilian_portuguese: "Abra no navegador", | ||
catalan: "Oberta al navegador", | ||
english: "Open in browser", | ||
french: "Ouvrir dans le navigateur", | ||
german: "Im Browser öffnen", | ||
italian: "Apri nel browser", | ||
russian: "Открыть в браузере", | ||
spanish: "Abrir en navegador", | ||
}, | ||
hint: { | ||
brazilian_portuguese: "Abre o arquivo atual no seu navegador padrão", | ||
catalan: "Obre el fitxer actual al navegador predeterminat", | ||
english: "Opens the current file in your default browser", | ||
french: "Ouvre le fichier actuel dans votre navigateur par défaut", | ||
german: "Öffnet die aktuelle Datei in Ihrem Standardbrowser", | ||
italian: "Apre il file corrente nel browser predefinito", | ||
russian: "Открывает текущий файл в браузере по умолчанию", | ||
spanish: "Abre el archivo actual en tu navegador por defecto", | ||
} | ||
}; | ||
|
||
export default function translate(text, language) { | ||
const string = strings[text][language]; | ||
if (!string) return strings[text].english; | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import open from "open"; | ||
import translate from "./i18n.js"; | ||
|
||
const path = window.require("path"); | ||
|
||
export function entry({ StatusBarItem, StaticConfig, RunningConfig }) { | ||
var file; | ||
const item = new StatusBarItem({ | ||
label: translate("label", StaticConfig.data.appLanguage), | ||
hint: translate("hint", StaticConfig.data.appLanguage), | ||
action: () => { | ||
if (file) | ||
open(file); | ||
} | ||
}); | ||
item.hide(); | ||
RunningConfig.on("aTabHasBeenFocused", ({ directory }) => { | ||
const extension = path.extname(directory).toLowerCase(); | ||
if (/\.(html|png|svg)$/.test(extension)) { | ||
file = directory; | ||
item.show(); | ||
} else { | ||
file = null; | ||
item.hide(); | ||
} | ||
}); | ||
|
||
StaticConfig.keyChanged("appLanguage", (language) => { | ||
item.setLabel(translate("label", language)); | ||
item.setHint(translate("hint", language)); | ||
}); | ||
} |
Oops, something went wrong.