X Tutup
Skip to content

Commit 50f1f7c

Browse files
committed
sVB 3.5.8 fixing localization and adding the Serbial documentation file.
1 parent 2b28658 commit 50f1f7c

File tree

10 files changed

+10010
-397
lines changed

10 files changed

+10010
-397
lines changed

LangServices/CompletionItemWrapper.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ Namespace Microsoft.SmallVisualBasic.LanguageService
284284
.Summary = If(item.DisplayName = "Me",
285285
$"Me is a global variable that referes to the current form, which is {item.Key} in this context. " &
286286
$"You can use this variable as an object like Me.Left = 0",
287-
$"A global variable that referes to a {item.ObjectName} control that you created by the form designer. " &
287+
$"A global variable for a {item.ObjectName} control created by the form designer. " &
288288
$"You can use this variable as an object like {item.DisplayName}.Left = 0"
289289
)
290290
}

LangServices/ModuleDocumentation.vb

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,36 @@ Namespace Microsoft.SmallVisualBasic.LanguageService
2828

2929
Private Function GetLocalizedModuleDocPath(modulePath As String) As String
3030
Dim directoryName = Path.GetDirectoryName(modulePath)
31-
Dim fileNameWithoutExtension = Path.GetFileNameWithoutExtension(modulePath)
32-
Dim ietfLanguageTag = CultureInfo.CurrentUICulture.IetfLanguageTag
33-
Dim text = Path.Combine(directoryName, $"{fileNameWithoutExtension}.{ietfLanguageTag}.xml")
31+
Dim fileName = Path.GetFileNameWithoutExtension(modulePath)
3432

35-
If File.Exists(text) Then
36-
Return text
33+
Dim docPath = GetLocalizedDocPath(directoryName, fileName, CultureInfo.CurrentUICulture)
34+
If docPath = "" Then
35+
docPath = GetLocalizedDocPath(directoryName, fileName, CultureInfo.CurrentCulture)
3736
End If
3837

39-
ietfLanguageTag = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName
40-
text = Path.Combine(directoryName, $"{fileNameWithoutExtension}.{ietfLanguageTag}.xml")
41-
42-
If File.Exists(text) Then
43-
Return text
38+
If docPath = "" Then
39+
docPath = Path.Combine(directoryName, fileName & ".xml")
4440
End If
4541

46-
If CultureInfo.CurrentUICulture.Parent IsNot Nothing Then
47-
ietfLanguageTag = CultureInfo.CurrentUICulture.Parent.IetfLanguageTag
48-
text = Path.Combine(directoryName, $"{fileNameWithoutExtension}.{ietfLanguageTag}.xml")
42+
Return docPath
43+
End Function
44+
45+
Private Shared Function GetLocalizedDocPath(directoryName As String, fileName As String, cult As CultureInfo) As String
46+
Dim ietfLanguageTag = cult.IetfLanguageTag
47+
Dim text = Path.Combine(directoryName, $"{fileName}.{ietfLanguageTag}.xml")
48+
If File.Exists(text) Then Return text
49+
50+
ietfLanguageTag = cult.TwoLetterISOLanguageName
51+
text = Path.Combine(directoryName, $"{fileName}.{ietfLanguageTag}.xml")
52+
If File.Exists(text) Then Return text
4953

50-
If File.Exists(text) Then
51-
Return text
52-
End If
54+
If cult.Parent IsNot Nothing Then
55+
ietfLanguageTag = cult.Parent.IetfLanguageTag
56+
text = Path.Combine(directoryName, $"{fileName}.{ietfLanguageTag}.xml")
57+
If File.Exists(text) Then Return text
5358
End If
5459

55-
Return Path.Combine(directoryName, fileNameWithoutExtension & ".xml")
60+
Return ""
5661
End Function
5762

5863
Private Sub ProcessDocumentation(xmlFilePath As String)

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<h2>Meet the sVB little daughter, <a href="https://marketplace.visualstudio.com/items?itemName=ModernVBNET.Sahla">Sahla</a></h2>
44
<h3>Sahla is a native Basic-dialect written with sVB. It started with the Arabic dialect, and it also has English and Serbian dialects now.</h3>
55
<p style="font-size:1.2em;">You can easily customize Sahla by translating its keywords into your language to have your own localized Basic dialect.</p>
6+
<b><span style="color:red;">Starting from sVB 3.5.8, you can localize the language documentation that pops up when you move to any code item. A Serbian documentation file, SmallVisualBasicLibrary.sr.xml, is included in the bin folder, thanks to Dr. Aca Cvetkovi?. You can also localize the SmallVisualBasicLibrary.xml file (but keep the xml tags untouched), give it a local sub extension like SmallVisualBasicLibrary.fr.xml, and place it in the "Modern VB\Small Visual Basic 3.5.8\Bin" folder in your installation folder like "C:\Program Files (x86)\Modern VB\Small Visual Basic 3.5.8\Bin" to make sVB show your localized docs.</span></b>
67
</div>
78
<span style="font-size:2em;">You can download the sVB installer from the <a href="https://marketplace.visualstudio.com/items?itemName=ModernVBNET.sVBInstaller"><u>VS marketplace</u></a>.</span>
89
<br><br>

SmallBasicIDE/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:shell="clr-namespace:Microsoft.SmallVisualBasic.Shell"
77
xmlns:DH="clr-namespace:DiagramHelper;assembly=DiagramHelper"
88
x:Name="ShellWindow" Height="800" Width="1024"
9-
Title="Small Visual Basic v3.5.7.5" Loaded="Window_Loaded"
9+
Title="Small Visual Basic v3.5.8" Loaded="Window_Loaded"
1010
WindowStartupLocation="CenterScreen" WindowState="Maximized" ContentRendered ="Window_ContentRendered"
1111
Icon="smallbasic.ico">
1212

SmallBasicIDE/My Project/AssemblyInfo.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ Imports System.Runtime.InteropServices
1717
<Assembly: ComVisible(False)>
1818
'The following GUID is for the ID of the typelib if this project is exposed to COM
1919
<Assembly: Guid("0ea75d2e-419e-4664-a419-6a4d88fb73fc")>
20-
<Assembly: AssemblyVersion("3.5.7.5")>
21-
<Assembly: AssemblyFileVersion("3.5.7.5")>
20+
<Assembly: AssemblyVersion("3.5.8.0")>
21+
<Assembly: AssemblyFileVersion("3.5.8.0")>

SmallBasicIDE/Shell/ErrorListControl.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
xmlns:lu="clr-namespace:Microsoft.SmallVisualBasic.Utility"
55
xmlns:sb="clr-namespace:Microsoft.SmallVisualBasic"
66
Height="0" BorderThickness="0" Background="#00FFFFFF"
7-
FlowDirection="{x:Static sb:App.FlowDirection}"
7+
FlowDirection="{x:Static sb:App.FlowDirection}"
8+
FontSize="14"
89
xmlns:shell="clr-namespace:Microsoft.SmallVisualBasic.Shell">
910

1011
<Control.Template>

SmallBasicIDE/Shell/ErrorListControl.xaml.vb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,26 @@ Namespace Microsoft.SmallVisualBasic.Shell
9292
DoubleAnimateHeight(0.0)
9393
End Sub
9494

95+
Private Sub ErrorListControl_PreviewMouseWheel(sender As Object, e As MouseWheelEventArgs) Handles Me.PreviewMouseWheel
96+
If (Keyboard.Modifiers And ModifierKeys.Control) > 0 Then
97+
If e.Delta > 0 Then
98+
Me.FontSize = Math.Min(30, Me.FontSize + 1)
99+
Else
100+
Me.FontSize = Math.Max(10, Me.FontSize - 1)
101+
End If
102+
e.Handled = True
103+
End If
104+
End Sub
105+
106+
Private Sub ErrorListControl_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles Me.PreviewKeyDown
107+
If (Keyboard.Modifiers And ModifierKeys.Control) > 0 Then
108+
If e.Key = Key.OemPlus Then
109+
Me.FontSize = Math.Min(30, Me.FontSize + 1)
110+
ElseIf e.Key = Key.OemMinus Then
111+
Me.FontSize = Math.Max(10, Me.FontSize - 1)
112+
End If
113+
e.Handled = True
114+
End If
115+
End Sub
95116
End Class
96117
End Namespace

SmallBasicLibrary/WinForms/Date.vb

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,23 @@ Namespace WinForms
6767

6868
Private Shared Function GetLocalCulture() As CultureInfo
6969
If localCulture Is Nothing Then
70-
Try
71-
Dim langs = System.Windows.Input.InputLanguageManager.Current.AvailableInputLanguages.GetEnumerator()
72-
langs.MoveNext()
73-
If langs.MoveNext() Then
74-
localCulture = langs.Current
75-
Else
76-
localCulture = CultureInfo.CurrentCulture
77-
End If
78-
Catch ex As Exception
70+
If CultureInfo.CurrentCulture.IetfLanguageTag <> "en" Then
7971
localCulture = CultureInfo.CurrentCulture
80-
End Try
72+
ElseIf CultureInfo.CurrentUICulture.IetfLanguageTag <> "en" Then
73+
localCulture = CultureInfo.CurrentUICulture
74+
Else
75+
Try
76+
Dim langs = System.Windows.Input.InputLanguageManager.Current.AvailableInputLanguages.GetEnumerator()
77+
langs.MoveNext()
78+
If langs.MoveNext() Then
79+
localCulture = langs.Current
80+
Else
81+
localCulture = CultureInfo.CurrentCulture
82+
End If
83+
Catch ex As Exception
84+
localCulture = CultureInfo.CurrentCulture
85+
End Try
86+
End If
8187
End If
8288
Return localCulture
8389
End Function

0 commit comments

Comments
 (0)
X Tutup