Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions minecraft-modrinth/lang/de/strings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

return [
'plugin_name' => 'Modrinth',
'minecraft_mods' => 'Minecraft Mods',
'minecraft_plugins' => 'Minecraft Plugins',

'settings' => [
'latest_minecraft_version' => 'Neueste Minecraft-Version',
'settings_saved' => 'Einstellungen gespeichert',
],

'page' => [
'open_folder' => ':folder-Ordner öffnen',
'minecraft_version' => 'Minecraft-Version',
'loader' => 'Loader',
'installed' => 'Installiert :type',
'unknown' => 'Unbekannt',
],

'table' => [
'columns' => [
'title' => 'Titel',
'author' => 'Autor',
'downloads' => 'Downloads',
'date_modified' => 'Geändert',
],
],

'version' => [
'type' => 'Typ',
'downloads' => 'Downloads',
'published' => 'Veröffentlicht',
'changelog' => 'Änderungsprotokoll',
'no_file_found' => 'Keine Datei gefunden',
],

'actions' => [
'download' => 'Herunterladen',
],

'notifications' => [
'download_started' => 'Download gestartet',
'download_failed' => 'Download konnte nicht gestartet werden',
],
];
46 changes: 46 additions & 0 deletions minecraft-modrinth/lang/en/strings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

return [
'plugin_name' => 'Modrinth',
'minecraft_mods' => 'Minecraft Mods',
'minecraft_plugins' => 'Minecraft Plugins',

'settings' => [
'latest_minecraft_version' => 'Latest Minecraft Version',
'settings_saved' => 'Settings saved',
],

'page' => [
'open_folder' => 'Open :folder folder',
'minecraft_version' => 'Minecraft Version',
'loader' => 'Loader',
'installed' => 'Installed :type',
'unknown' => 'Unknown',
],

'table' => [
'columns' => [
'title' => 'Title',
'author' => 'Author',
'downloads' => 'Downloads',
'date_modified' => 'Modified',
],
],

'version' => [
'type' => 'Type',
'downloads' => 'Downloads',
'published' => 'Published',
'changelog' => 'Changelog',
'no_file_found' => 'No file found',
],

'actions' => [
'download' => 'Download',
],

'notifications' => [
'download_started' => 'Download started',
'download_failed' => 'Download could not be started',
],
];
4 changes: 2 additions & 2 deletions minecraft-modrinth/src/Enums/ModrinthProjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ enum ModrinthProjectType: string implements HasLabel
public function getLabel(): string
{
return match ($this) {
self::Mod => 'Minecraft Mods',
self::Plugin => 'Minecraft Plugins',
self::Mod => trans('minecraft-modrinth::strings.minecraft_mods'),
self::Plugin => trans('minecraft-modrinth::strings.minecraft_plugins'),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function table(Table $table): Table
}

$schema[] = Section::make($versionData['name'])
->description($versionData['version_number'] . ($primaryFile ? ' (' . convert_bytes_to_readable($primaryFile['size']) . ')' : ' (No file found)'))
->description($versionData['version_number'] . ($primaryFile ? ' (' . convert_bytes_to_readable($primaryFile['size']) . ')' : ' (' . trans('minecraft-modrinth::strings.version.no_file_found') . ')'))
->collapsed(!$versionData['featured'])
->collapsible()
->icon($versionData['version_type'] === 'alpha' ? 'tabler-circle-letter-a' : ($versionData['version_type'] === 'beta' ? 'tabler-circle-letter-b' : 'tabler-circle-letter-r'))
Expand Down Expand Up @@ -156,15 +156,15 @@ public function table(Table $table): Table
$fileRepository->setServer($server)->pull($primaryFile['url'], ModrinthProjectType::fromServer($server)->getFolder());

Notification::make()
->title('Download started')
->title(trans('minecraft-modrinth::strings.notifications.download_started'))
->body($versionData['name'])
->success()
->send();
} catch (Exception $exception) {
report($exception);

Notification::make()
->title('Download could not be started')
->title(trans('minecraft-modrinth::strings.notifications.download_failed'))
->body($exception->getMessage())
->danger()
->send();
Expand All @@ -187,7 +187,7 @@ protected function getHeaderActions(): array

return [
Action::make('open_folder')
->label(fn () => 'Open ' . $folder . ' folder')
->label(fn () => trans('minecraft-modrinth::strings.page.open_folder', ['folder' => $folder]))
->url(fn () => ListFiles::getUrl(['path' => $folder]), true),
];
}
Expand All @@ -202,13 +202,13 @@ public function content(Schema $schema): Schema
Grid::make(3)
->schema([
TextEntry::make('Minecraft Version')
->state(fn () => MinecraftModrinth::getMinecraftVersion($server) ?? 'Unknown')
->state(fn () => MinecraftModrinth::getMinecraftVersion($server) ?? trans('minecraft-modrinth::strings.page.unknown'))
->badge(),
TextEntry::make('Loader')
->state(fn () => MinecraftLoader::fromServer($server)?->getLabel() ?? 'Unknown')
->state(fn () => MinecraftLoader::fromServer($server)?->getLabel() ?? trans('minecraft-modrinth::strings.page.unknown'))
->badge(),
TextEntry::make('installed')
->label(fn () => 'Installed ' . ModrinthProjectType::fromServer($server)->getLabel())
->label(fn () => trans('minecraft-modrinth::strings.page.installed', ['type' => ModrinthProjectType::fromServer($server)->getLabel()]))
->state(function (DaemonFileRepository $fileRepository) use ($server) {
try {
$files = $fileRepository->setServer($server)->getDirectory(ModrinthProjectType::fromServer($server)->getFolder());
Expand All @@ -223,7 +223,7 @@ public function content(Schema $schema): Schema
} catch (Exception $exception) {
report($exception);

return 'Unknown';
return trans('minecraft-modrinth::strings.page.unknown');
}
})
->badge(),
Expand Down
4 changes: 2 additions & 2 deletions minecraft-modrinth/src/MinecraftModrinthPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getSettingsForm(): array
{
return [
TextInput::make('latest_minecraft_version')
->label('Latest Minecraft Version')
->label(trans('minecraft-modrinth::strings.settings.latest_minecraft_version'))
->required()
->default(fn () => config('minecraft-modrinth.latest_minecraft_version', '1.21.11')),
];
Expand All @@ -44,7 +44,7 @@ public function saveSettings(array $data): void
]);

Notification::make()
->title('Settings saved')
->title(trans('minecraft-modrinth::strings.settings.settings_saved'))
->success()
->send();
}
Expand Down