Skip to content

Commit

Permalink
Update for Flarum 1.0, enable for admin frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkwinkelmann committed Jun 4, 2021
1 parent 415e35b commit 15469ad
Show file tree
Hide file tree
Showing 23 changed files with 1,082 additions and 647 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@

Enable forum users to find details about translations.

This is an early version of the extension. A future update will allow coupling with a report feature.
Features:

Current features:

- A link in the sidebar enables "inspect" mode
- A link in the session dropdown enables "inspect" mode
- When "inspect" mode is active, all translatable texts are highlighted
- Clicking on a text brings up a modal with details about the translation key, which extension provides it and a link to the source file if it's on GitHub
- The feature is protected by a permission, but the link is currently visible to everyone all the time
- Clicking on a text brings up a modal with details about the translation key, which extension provides it, and a link to the source file if it's on GitHub
- If you are in a context where you cannot click the inspect button (for example as guest or inside a modal), you can run `startTranslationInspection()` from the browser console

> Caution: if you have private extensions or local extenders installed, this extension could expose their repository URLs, names, icons or relative paths to some of their yaml files to users with the Inspect permission!
> Caution: if you have private extensions or local extenders installed, this extension could expose their repository URLs, names, icons or relative paths to some of their yaml files
With the current feature set it probably doesn't make much sense to install this extension on a production forum.
It is more meant as a developer tool.

## Installation

Expand All @@ -34,3 +35,4 @@ Support is offered on a "best effort" basis through the Flarum community thread.

- [GitHub](https://github.com/clarkwinkelmann/flarum-ext-translation-inspector)
- [Packagist](https://packagist.org/packages/clarkwinkelmann/flarum-ext-translation-inspector)
- [Discuss](https://discuss.flarum.org/d/26192)
12 changes: 9 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@
"name": "clarkwinkelmann/flarum-ext-translation-inspector",
"description": "Enable forum users to find details about translations",
"keywords": [
"flarum"
"flarum",
"devtools"
],
"type": "flarum-extension",
"license": "MIT",
"require": {
"flarum/core": ">=0.1.0-beta.15 <0.1.0-beta.16",
"flarum/core": "^1.0",
"ext-json": "*"
},
"authors": [
{
"name": "Clark Winkelmann",
"email": "[email protected]",
"homepage": "https://clarkwinkelmann.com/",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/clarkwinkelmann/flarum-ext-translation-inspector/issues",
"source": "https://github.com/clarkwinkelmann/flarum-ext-translation-inspector"
"source": "https://github.com/clarkwinkelmann/flarum-ext-translation-inspector",
"forum": "https://discuss.flarum.org/d/26192"
},
"autoload": {
"psr-4": {
Expand All @@ -35,6 +38,9 @@
"backgroundColor": "#684ba6",
"color": "#fff"
}
},
"flagrow": {
"discuss": "https://discuss.flarum.org/d/26192"
}
}
}
11 changes: 9 additions & 2 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@

namespace ClarkWinkelmann\TranslationInspector;

use Flarum\Api\Serializer\ForumSerializer;
use Flarum\Extend;

return [
(new Extend\Frontend('admin'))
->js(__DIR__ . '/js/dist/admin.js'),
->js(__DIR__ . '/js/dist/admin.js')
->css(__DIR__ . '/resources/less/common.less'),
(new Extend\Frontend('forum'))
->js(__DIR__ . '/js/dist/forum.js')
->css(__DIR__ . '/resources/less/forum.less'),
->css(__DIR__ . '/resources/less/common.less'),

new Extend\Locales(__DIR__ . '/resources/locale'),

(new Extend\Routes('api'))
->get('/inspect-translation', 'inspect-translation', Controllers\InspectTranslationController::class),

(new Extend\ApiSerializer(ForumSerializer::class))
->attribute('canInspectTranslations', function (ForumSerializer $serializer): bool {
return $serializer->getActor()->can('clarkwinkelmann-translation-inspector.inspect');
}),
];
2 changes: 1 addition & 1 deletion js/dist/admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/dist/admin.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 15469ad

Please sign in to comment.