Skip to content

Commit 469b814

Browse files
authored
Merge pull request #247 from cjakeman/spanish-manual2
adds Manual.pdf in Spanish
2 parents 0522c3f + ebdf858 commit 469b814

File tree

4 files changed

+44
-15
lines changed

4 files changed

+44
-15
lines changed
28.5 MB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This is a temporary arrangement to make the Spanish manual maintained by Javier (Xavivilla) available to all users.
2+
The intention is to get Javier to update his rst files using GitHub and make them part of the build that delivers the English manual.

Source/Menu/MainForm.cs

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -231,21 +231,18 @@ orderby tool.Text
231231
var path = dir + @"\Documentation\";
232232
if (Directory.Exists(path))
233233
{
234-
foreach (string entry in Directory.GetFiles(path))
234+
// Load English documents
235+
LoadDocuments(docs, path);
236+
237+
// Find any non-English documents by looking in \Documentation\<language code>\, e.g. \Documentation\es\
238+
foreach (var codePath in Directory.GetDirectories(path))
235239
{
236-
// These are the following formats that can be selected.
237-
if (entry.Contains(".pdf") || entry.Contains(".doc") || entry.Contains(".docx") || entry.Contains(".pptx") || entry.Contains(".txt"))
238-
{
239-
var i = entry.LastIndexOf("\\");
240-
docs.Add(new ToolStripMenuItem(entry.Substring(i + 1), null, (Object sender2, EventArgs e2) =>
241-
{
242-
var docPath = (sender2 as ToolStripItem).Tag as string;
243-
Process.Start(docPath);
244-
}) { Tag = entry });
245-
}
246-
contextMenuStripDocuments.Items.AddRange((from tool in docs
247-
orderby tool.Text
248-
select tool).ToArray());
240+
// Extract the last folder in the path - the language code, e.g. "es"
241+
var code = System.IO.Path.GetFileName(codePath);
242+
243+
// include any non-English documents that match the chosen language
244+
if (code == Settings.Language)
245+
LoadDocuments(docs, codePath, code);
249246
}
250247
}
251248
else
@@ -264,6 +261,29 @@ orderby tool.Text
264261
}
265262
}
266263

264+
private void LoadDocuments(List<ToolStripItem> docs, string folderPath, string code = null)
265+
{
266+
foreach (var filePath in Directory.GetFiles(folderPath))
267+
{
268+
var ext = System.IO.Path.GetExtension(filePath);
269+
var name = System.IO.Path.GetFileNameWithoutExtension(filePath);
270+
// These are the formats that can be selected.
271+
if (new[] { ".pdf", ".doc", ".docx", ".pptx", ".txt" }.Contains(ext.ToLowerInvariant()))
272+
{
273+
var codeLabel = string.IsNullOrEmpty(code) ? "" : $" [{code}]";
274+
docs.Add(new ToolStripMenuItem($"{name}{ext}{codeLabel}", null, (object sender2, EventArgs e2) =>
275+
{
276+
var docPath = (sender2 as ToolStripItem).Tag as string;
277+
Process.Start(docPath);
278+
})
279+
{ Tag = filePath });
280+
}
281+
contextMenuStripDocuments.Items.AddRange((from tool in docs
282+
orderby tool.Text
283+
select tool).ToArray());
284+
}
285+
}
286+
267287
void MainForm_FormClosing(object sender, FormClosingEventArgs e)
268288
{
269289
SaveOptions();

Source/Menu/Menu.csproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,13 @@
198198
</PreBuildEvent>
199199
<PostBuildEvent>echo $Revision: 000 $&gt;Revision.txt
200200
date /t&gt;&gt;Revision.txt
201-
time /t&gt;&gt;Revision.txt</PostBuildEvent>
201+
time /t&gt;&gt;Revision.txt
202+
203+
REM Copy Spanish manual until we can make its RST files part of the build.
204+
CD ..\
205+
IF EXIST "Program\Documentation\es" RMDIR "Program\Documentation\es" /S /Q
206+
IF NOT EXIST "Program\Documentation\es" MKDIR "Program\Documentation\es"
207+
COPY "Source\Documentation\Manual\es\Manual.pdf" "Program\Documentation\es\"
208+
</PostBuildEvent>
202209
</PropertyGroup>
203210
</Project>

0 commit comments

Comments
 (0)