Skip to content

Commit 1249267

Browse files
committed
localizatin + camera fix
1 parent b100d2f commit 1249267

19 files changed

Lines changed: 274 additions & 29 deletions

src/PrompterOne.Shared/AppShell/Layout/MainLayout.ScriptImport.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ namespace PrompterOne.Shared.Layout;
1212
public partial class MainLayout
1313
{
1414
private const int ImportProgressStepCount = 3;
15-
private const string ImportScriptMessage = "Unable to import this script.";
1615
private const string ImportScriptOperation = "Shell import script";
17-
private const string ImportScriptUnsupportedDetail = "Choose a supported script or document file such as .tps, .md, .txt, .pdf, or .docx.";
1816
private const long ImportScriptMaximumFileSizeBytes = 5 * 1024 * 1024;
1917
protected internal static string SupportedImportAcceptValue => ScriptDocumentFileTypes.PickerAcceptValue;
2018

@@ -59,14 +57,17 @@ private async Task HandleImportScriptAsync(InputFileChangeEventArgs args)
5957
var file = args.File;
6058
if (!ScriptDocumentImportService.CanImport(file.Name))
6159
{
62-
Diagnostics.ReportRecoverable(ImportScriptOperation, ImportScriptMessage, ImportScriptUnsupportedDetail);
60+
Diagnostics.ReportRecoverable(
61+
ImportScriptOperation,
62+
Text(UiTextKey.ImportScriptMessage),
63+
Text(UiTextKey.ImportScriptUnsupportedDetail));
6364
return;
6465
}
6566

6667
await SetImportProgressAsync(file.Name, UiTextKey.HeaderImportReading, 1);
6768
await Diagnostics.RunAsync(
6869
ImportScriptOperation,
69-
ImportScriptMessage,
70+
Text(UiTextKey.ImportScriptMessage),
7071
async () =>
7172
{
7273
await Bootstrapper.EnsureReadyAsync();

src/PrompterOne.Shared/Editor/Pages/EditorPage.DocumentSplit.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private Task OnSplitRequestedAsync(TpsDocumentSplitMode mode)
2525
{
2626
Diagnostics.ReportRecoverable(
2727
SplitDraftOperation,
28-
SplitDraftNoMatchesMessage,
28+
Text(UiTextKey.EditorSplitNoMatchesMessage),
2929
ResolveSplitRequirementDetail(mode));
3030
_splitFeedback = null;
3131
StateHasChanged();
@@ -34,7 +34,7 @@ private Task OnSplitRequestedAsync(TpsDocumentSplitMode mode)
3434

3535
return Diagnostics.RunAsync(
3636
SplitDraftOperation,
37-
SplitDraftMessage,
37+
Text(UiTextKey.EditorSplitDraftMessage),
3838
async () =>
3939
{
4040
CancelAutosave();

src/PrompterOne.Shared/Editor/Pages/EditorPage.DragDrop.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using PrompterOne.Core.Models.Editor;
22
using PrompterOne.Core.Services.Editor;
3+
using PrompterOne.Shared.Localization;
34

45
namespace PrompterOne.Shared.Pages;
56

@@ -11,7 +12,10 @@ private Task OnFilesDroppedAsync(EditorDroppedFilesRequest request)
1112
{
1213
if (request.RejectedFileNames.Count > 0)
1314
{
14-
Diagnostics.ReportRecoverable(DropScriptOperation, DropScriptMessage, DropScriptUnsupportedDetail);
15+
Diagnostics.ReportRecoverable(
16+
DropScriptOperation,
17+
Text(UiTextKey.ImportScriptMessage),
18+
Text(UiTextKey.EditorDropUnsupportedDetail));
1519
}
1620

1721
return Task.CompletedTask;
@@ -20,7 +24,7 @@ private Task OnFilesDroppedAsync(EditorDroppedFilesRequest request)
2024
Diagnostics.ClearRecoverable(DropScriptOperation);
2125
return Diagnostics.RunAsync(
2226
DropScriptOperation,
23-
DropScriptMessage,
27+
Text(UiTextKey.ImportScriptMessage),
2428
() => ImportDroppedFilesAsync(request));
2529
}
2630

@@ -36,7 +40,10 @@ private async Task ImportDroppedFilesAsync(EditorDroppedFilesRequest request)
3640

3741
if (importedBodies.Length == 0)
3842
{
39-
Diagnostics.ReportRecoverable(DropScriptOperation, DropScriptMessage, DropScriptUnsupportedDetail);
43+
Diagnostics.ReportRecoverable(
44+
DropScriptOperation,
45+
Text(UiTextKey.ImportScriptMessage),
46+
Text(UiTextKey.EditorDropUnsupportedDetail));
4047
return;
4148
}
4249

src/PrompterOne.Shared/Editor/Pages/EditorPage.FileSave.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using PrompterOne.Core.Models.Workspace;
22
using PrompterOne.Core.Services.Editor;
3+
using PrompterOne.Shared.Localization;
34
using PrompterOne.Shared.Services;
45

56
namespace PrompterOne.Shared.Pages;
@@ -14,7 +15,7 @@ private async Task HandleSaveFileRequestedAsync(CancellationToken cancellationTo
1415

1516
await Diagnostics.RunAsync(
1617
SaveFileOperation,
17-
SaveFileMessage,
18+
Text(UiTextKey.EditorSaveFileMessage),
1819
async () =>
1920
{
2021
await PersistDraftStateCoreAsync(persistDocument: true, cancellationToken, revision);

src/PrompterOne.Shared/Editor/Pages/EditorPage.Loading.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Globalization;
22
using PrompterOne.Core.Models.Workspace;
33
using PrompterOne.Shared.Components.Editor;
4+
using PrompterOne.Shared.Localization;
45
using PrompterOne.Shared.Services;
56

67
namespace PrompterOne.Shared.Pages;
@@ -24,7 +25,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
2425
_loadState = false;
2526
await Diagnostics.RunAsync(
2627
LoadEditorOperation,
27-
LoadEditorMessage,
28+
Text(UiTextKey.EditorLoadMessage),
2829
async () =>
2930
{
3031
await Bootstrapper.EnsureReadyAsync();
@@ -154,7 +155,7 @@ private void UpdateSyntaxDiagnostics()
154155
return;
155156
}
156157

157-
Diagnostics.ReportRecoverable(EditorSyntaxOperation, EditorSyntaxMessage, _errorMessage);
158+
Diagnostics.ReportRecoverable(EditorSyntaxOperation, Text(UiTextKey.EditorSyntaxMessage), _errorMessage);
158159
}
159160

160161
private void ResetHistoryIfNeeded(bool resetHistory)

src/PrompterOne.Shared/Editor/Pages/EditorPage.Persistence.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using PrompterOne.Core.Services.Workspace;
2+
using PrompterOne.Shared.Localization;
23

34
namespace PrompterOne.Shared.Pages;
45

@@ -36,7 +37,12 @@ private async Task PersistAutosaveAsync(string text, CancellationToken cancellat
3637
}
3738

3839
private Task PersistPreparedDraftAsync(long revision, CancellationToken cancellationToken) =>
39-
TryPersistDraftStateAsync(PersistDraftOperation, PersistDraftMessage, persistDocument: true, cancellationToken, revision);
40+
TryPersistDraftStateAsync(
41+
PersistDraftOperation,
42+
Text(UiTextKey.EditorPersistDraftMessage),
43+
persistDocument: true,
44+
cancellationToken,
45+
revision);
4046

4147
private Task<bool> TryPersistDraftStateAsync(
4248
string operation,

src/PrompterOne.Shared/Editor/Pages/EditorPage.razor.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,11 @@ namespace PrompterOne.Shared.Pages;
1616
public partial class EditorPage
1717
{
1818
private const string LoadEditorOperation = "Editor load";
19-
private const string LoadEditorMessage = "Unable to load the editor right now.";
2019
private const string PersistDraftOperation = "Editor save draft";
21-
private const string PersistDraftMessage = "Unable to save the current draft.";
22-
private const string DropScriptMessage = "Unable to import this script.";
2320
private const string DropScriptOperation = "Editor drop script";
24-
private const string DropScriptUnsupportedDetail = "Drop a .tps, .tps.md, .md.tps, .md, or .txt file onto the editor.";
25-
private const string SaveFileMessage = "Unable to save this script to disk.";
2621
private const string SaveFileOperation = "Editor save file";
27-
private const string SplitDraftMessage = "Unable to split the current draft right now.";
28-
private const string SplitDraftNoMatchesMessage = "Add more section headings before splitting this draft.";
2922
private const string SplitDraftOperation = "Editor split draft";
3023
private const string EditorSyntaxOperation = "Editor syntax";
31-
private const string EditorSyntaxMessage = "The TPS draft has a syntax issue. Fix it and keep writing.";
3224
private const int DraftAnalysisDelayMilliseconds = 1_000;
3325
private const int AutosaveDelayMilliseconds = 1_500;
3426
private const int LargeDraftAnalysisDelayMilliseconds = 3_000;

src/PrompterOne.Shared/Localization/SharedResource.de.resx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,33 @@
8484
<data name="HeaderImportOpeningEditor" xml:space="preserve">
8585
<value>Editor wird geöffnet</value>
8686
</data>
87+
<data name="ImportScriptMessage" xml:space="preserve">
88+
<value>Dieses Skript konnte nicht importiert werden.</value>
89+
</data>
90+
<data name="ImportScriptUnsupportedDetail" xml:space="preserve">
91+
<value>Wählen Sie eine unterstützte Skript- oder Dokumentdatei wie .tps, .md, .txt, .pdf oder .docx.</value>
92+
</data>
93+
<data name="EditorDropUnsupportedDetail" xml:space="preserve">
94+
<value>Ziehen Sie eine Datei vom Typ .tps, .tps.md, .md.tps, .md oder .txt in den Editor.</value>
95+
</data>
96+
<data name="EditorLoadMessage" xml:space="preserve">
97+
<value>Der Editor konnte gerade nicht geladen werden.</value>
98+
</data>
99+
<data name="EditorPersistDraftMessage" xml:space="preserve">
100+
<value>Der aktuelle Entwurf konnte nicht gespeichert werden.</value>
101+
</data>
102+
<data name="EditorSaveFileMessage" xml:space="preserve">
103+
<value>Dieses Skript konnte nicht auf dem Datenträger gespeichert werden.</value>
104+
</data>
105+
<data name="EditorSplitDraftMessage" xml:space="preserve">
106+
<value>Der aktuelle Entwurf konnte gerade nicht aufgeteilt werden.</value>
107+
</data>
108+
<data name="EditorSplitNoMatchesMessage" xml:space="preserve">
109+
<value>Fügen Sie mehr Abschnittsüberschriften hinzu, bevor Sie diesen Entwurf aufteilen.</value>
110+
</data>
111+
<data name="EditorSyntaxMessage" xml:space="preserve">
112+
<value>Der TPS-Entwurf enthält ein Syntaxproblem. Beheben Sie es und schreiben Sie weiter.</value>
113+
</data>
87114
<data name="HeaderLearn" xml:space="preserve">
88115
<value>Lernen</value>
89116
</data>

src/PrompterOne.Shared/Localization/SharedResource.es.resx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,33 @@
8484
<data name="HeaderImportOpeningEditor" xml:space="preserve">
8585
<value>Abriendo editor</value>
8686
</data>
87+
<data name="ImportScriptMessage" xml:space="preserve">
88+
<value>No se pudo importar este guion.</value>
89+
</data>
90+
<data name="ImportScriptUnsupportedDetail" xml:space="preserve">
91+
<value>Elige un archivo de guion o documento compatible, como .tps, .md, .txt, .pdf o .docx.</value>
92+
</data>
93+
<data name="EditorDropUnsupportedDetail" xml:space="preserve">
94+
<value>Arrastra al editor un archivo .tps, .tps.md, .md.tps, .md o .txt.</value>
95+
</data>
96+
<data name="EditorLoadMessage" xml:space="preserve">
97+
<value>No se pudo cargar el editor en este momento.</value>
98+
</data>
99+
<data name="EditorPersistDraftMessage" xml:space="preserve">
100+
<value>No se pudo guardar el borrador actual.</value>
101+
</data>
102+
<data name="EditorSaveFileMessage" xml:space="preserve">
103+
<value>No se pudo guardar este guion en el disco.</value>
104+
</data>
105+
<data name="EditorSplitDraftMessage" xml:space="preserve">
106+
<value>No se pudo dividir el borrador actual en este momento.</value>
107+
</data>
108+
<data name="EditorSplitNoMatchesMessage" xml:space="preserve">
109+
<value>Agrega más encabezados de sección antes de dividir este borrador.</value>
110+
</data>
111+
<data name="EditorSyntaxMessage" xml:space="preserve">
112+
<value>El borrador TPS tiene un problema de sintaxis. Corrígelo y sigue escribiendo.</value>
113+
</data>
87114
<data name="HeaderLearn" xml:space="preserve">
88115
<value>Estudiar</value>
89116
</data>

src/PrompterOne.Shared/Localization/SharedResource.fr.resx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,33 @@
8484
<data name="HeaderImportOpeningEditor" xml:space="preserve">
8585
<value>Ouverture de l'éditeur</value>
8686
</data>
87+
<data name="ImportScriptMessage" xml:space="preserve">
88+
<value>Impossible d'importer ce script.</value>
89+
</data>
90+
<data name="ImportScriptUnsupportedDetail" xml:space="preserve">
91+
<value>Choisissez un fichier de script ou de document pris en charge, comme .tps, .md, .txt, .pdf ou .docx.</value>
92+
</data>
93+
<data name="EditorDropUnsupportedDetail" xml:space="preserve">
94+
<value>Déposez dans l'éditeur un fichier .tps, .tps.md, .md.tps, .md ou .txt.</value>
95+
</data>
96+
<data name="EditorLoadMessage" xml:space="preserve">
97+
<value>Impossible de charger l'éditeur pour le moment.</value>
98+
</data>
99+
<data name="EditorPersistDraftMessage" xml:space="preserve">
100+
<value>Impossible d'enregistrer le brouillon actuel.</value>
101+
</data>
102+
<data name="EditorSaveFileMessage" xml:space="preserve">
103+
<value>Impossible d'enregistrer ce script sur le disque.</value>
104+
</data>
105+
<data name="EditorSplitDraftMessage" xml:space="preserve">
106+
<value>Impossible de fractionner le brouillon actuel pour le moment.</value>
107+
</data>
108+
<data name="EditorSplitNoMatchesMessage" xml:space="preserve">
109+
<value>Ajoutez davantage de titres de section avant de fractionner ce brouillon.</value>
110+
</data>
111+
<data name="EditorSyntaxMessage" xml:space="preserve">
112+
<value>Le brouillon TPS contient une erreur de syntaxe. Corrigez-la et continuez à écrire.</value>
113+
</data>
87114
<data name="HeaderLearn" xml:space="preserve">
88115
<value>Apprendre</value>
89116
</data>

0 commit comments

Comments
 (0)