VERSION 5.00
Begin VB.Form Form13 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Language / Lenguaje"
   ClientHeight    =   10215
   ClientLeft      =   45
   ClientTop       =   405
   ClientWidth     =   5310
   BeginProperty Font 
      Name            =   "Arial"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "Form13.frx":0000
   LinkTopic       =   "Form13"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   10215
   ScaleWidth      =   5310
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.PictureBox Picture1 
      BorderStyle     =   0  'None
      Height          =   5775
      Left            =   120
      ScaleHeight     =   5775
      ScaleWidth      =   5175
      TabIndex        =   3
      Top             =   3240
      Visible         =   0   'False
      Width           =   5175
      Begin LibreAVC.IconoCtrl IconoCtrl7 
         Height          =   240
         Left            =   4440
         TabIndex        =   19
         Top             =   240
         Width           =   240
         _ExtentX        =   423
         _ExtentY        =   423
         Picture         =   "Form13.frx":058A
      End
      Begin LibreAVC.IconoCtrl IconoCtrl6 
         Height          =   240
         Left            =   4440
         TabIndex        =   18
         Top             =   720
         Width           =   240
         _ExtentX        =   423
         _ExtentY        =   423
         Picture         =   "Form13.frx":08DC
      End
      Begin VB.CommandButton Command5 
         Caption         =   "Es"
         Height          =   495
         Left            =   4080
         TabIndex        =   8
         Top             =   600
         Width           =   975
      End
      Begin VB.CommandButton Command4 
         Height          =   495
         Left            =   4080
         TabIndex        =   7
         Top             =   120
         Width           =   975
      End
      Begin VB.CommandButton Command3 
         Caption         =   "Save / Guardar"
         Height          =   495
         Left            =   3240
         TabIndex        =   6
         Top             =   5040
         Width           =   1815
      End
      Begin VB.TextBox Text2 
         Height          =   3735
         Left            =   0
         MultiLine       =   -1  'True
         ScrollBars      =   3  'Both
         TabIndex        =   5
         Top             =   1200
         Width           =   5055
      End
      Begin VB.TextBox Text1 
         Height          =   735
         Left            =   0
         Locked          =   -1  'True
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   4
         Text            =   "Form13.frx":0C2E
         Top             =   360
         Width           =   3975
      End
      Begin VB.Label Label1 
         Caption         =   "How Translate? / ¿Cómo traducir?"
         Height          =   255
         Left            =   0
         TabIndex        =   9
         Top             =   0
         Width           =   5055
      End
   End
   Begin LibreAVC.IconoCtrl IconoCtrl5 
      Height          =   240
      Left            =   1080
      TabIndex        =   17
      Top             =   720
      Width           =   240
      _ExtentX        =   423
      _ExtentY        =   423
      Picture         =   "Form13.frx":0CF8
   End
   Begin LibreAVC.IconoCtrl IconoCtrl4 
      Height          =   240
      Left            =   2160
      TabIndex        =   16
      Top             =   720
      Width           =   240
      _ExtentX        =   423
      _ExtentY        =   423
      Picture         =   "Form13.frx":104A
   End
   Begin LibreAVC.IconoCtrl IconoCtrl3 
      Height          =   240
      Left            =   3240
      TabIndex        =   15
      Top             =   720
      Width           =   240
      _ExtentX        =   423
      _ExtentY        =   423
      Picture         =   "Form13.frx":139C
   End
   Begin LibreAVC.IconoCtrl IconoCtrl2 
      Height          =   240
      Left            =   4200
      TabIndex        =   14
      Top             =   240
      Width           =   240
      _ExtentX        =   423
      _ExtentY        =   423
      Picture         =   "Form13.frx":16EE
   End
   Begin LibreAVC.IconoCtrl IconoCtrl1 
      Height          =   240
      Left            =   4800
      TabIndex        =   13
      Top             =   240
      Width           =   240
      _ExtentX        =   423
      _ExtentY        =   423
      Picture         =   "Form13.frx":1A40
   End
   Begin VB.CommandButton Command6 
      Height          =   495
      Left            =   720
      TabIndex        =   10
      Top             =   600
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "-"
      Height          =   495
      Left            =   4080
      TabIndex        =   2
      Top             =   120
      Width           =   495
   End
   Begin VB.CommandButton Command1 
      Caption         =   "+"
      Height          =   495
      Left            =   4680
      TabIndex        =   1
      Top             =   120
      Width           =   495
   End
   Begin VB.ComboBox Combo1 
      Height          =   330
      ItemData        =   "Form13.frx":1D92
      Left            =   120
      List            =   "Form13.frx":1D9F
      Style           =   2  'Dropdown List
      TabIndex        =   0
      Top             =   120
      Width           =   3855
   End
   Begin VB.CommandButton Command7 
      Height          =   495
      Left            =   1800
      TabIndex        =   11
      Top             =   600
      Width           =   975
   End
   Begin VB.CommandButton Command8 
      Height          =   495
      Left            =   2880
      TabIndex        =   12
      Top             =   600
      Width           =   975
   End
End
Attribute VB_Name = "Form13"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim LangActual As String
Dim HowTLang As Byte
Dim CambioTexto As Byte
Dim Aceptar As Byte

Private Sub Command1_Click()
If HowTLang = 0 Then Text2.Text = LoadResData(101, "TEXT") Else Text2.Text = LoadResData(102, "TEXT")
Text2.Text = Right(Text2.Text, Len(Text2.Text) - 1)
CambioTexto = 0
Picture1.Visible = True
Me.Height = 6210
End Sub

Private Sub Command2_Click()
If Combo1.ListIndex < 1 Then Exit Sub
If LCase(Combo1.List(Combo1.ListIndex)) = LCase(Lang.LangName) Then
MsgBox "No se puede eliminar el lenguaje seleccionado porque está en uso" & vbCrLf & "Can not delete the selected language because it is in use", vbOKOnly, Form1.Caption
Exit Sub
End If
If APIS.APIDeletePath(App.Path & "\appfiles\lang\" & Combo1.List(Combo1.ListIndex) & ".llg", 1) = True Then Combo1.RemoveItem (Combo1.ListIndex) Else Lang.MsgCanotDelFile
End Sub

Private Sub Command3_Click()
Dim LangName As String, NumArchivo As Integer
LangName = InputBox("Ingrese un nombre para el lenguaje" & vbCrLf & "Enter a name for the language", Form1.Caption)
If LangName = "" Then Exit Sub
If ScriptObj.CrearArbol(App.Path & "\appfiles\lang") = False Then
MsgBox "No se pudo crear el directorio / Could not create directory" & vbCrLf & App.Path & "\appfiles\lang", vbCritical, Form1.Caption
Exit Sub
End If
If ScriptObj.ExisteArchivo(App.Path & "\appfiles\lang\" & LangName & ".llg") = True Then
MsgBox "Ya existe un archivo con ese nombre" & vbCrLf & "A file already exists with that name", vbCritical, Form1.Caption
Exit Sub
End If
On Error GoTo ErrH
NumArchivo = FreeFile
Open App.Path & "\appfiles\lang\" & LangName & ".llg" For Binary As NumArchivo
Put NumArchivo, , Text2.Text
Close NumArchivo
Combo1.AddItem LangName
MsgBox "Nuevo lenguaje fue agregado" & vbCrLf & "New language was added", vbOKOnly, Form1.Caption
Exit Sub
ErrH:
MsgBox "Error: No se pudo guardar" & vbCrLf & "Error: It could not be saved", vbCritical, Form1.Caption
Call ScriptObj.BorrarArchivo(App.Path & "\appfiles\lang\" & LangName & ".llg", True)
End Sub

Private Sub Command4_Click()
Text1.Text = "To add a new language:" & vbCrLf & "Translate line by line the following text" & vbCrLf & "Tip You: short text and use the google translate service, then paste the output into the text box"
If CambioTexto = 0 Then
Text2.Text = LoadResData(102, "TEXT")
Text2.Text = Right(Text2.Text, Len(Text2.Text) - 1)
CambioTexto = 0
End If
HowTLang = 1
End Sub

Private Sub Command5_Click()
Text1.Text = "Para crear un lenguaje:" & vbCrLf & "Traduce línea por línea el siguiente texto" & vbCrLf & "Sugerencia: corta el texto y utiliza el servicio de google para traducir, después pega el resultado en el cuadro de texto"
If CambioTexto = 0 Then
Text2.Text = LoadResData(101, "TEXT")
Text2.Text = Right(Text2.Text, Len(Text2.Text) - 1)
CambioTexto = 0
End If
HowTLang = 0
End Sub

Private Sub Command6_Click()
Dim Nombre As String, OutExtIsAuto As Byte
If Combo1.ListIndex > -1 Then Nombre = Combo1.List(Combo1.ListIndex) Else Exit Sub
If LCase(Nombre) = LCase(Lang.LangName) Then Exit Sub
Call Aplicacion.ValidarOutEdit
Call Aplicacion.ValidarOutFmt
Form1.Combo2.Tag = Form1.Combo2.Text
If LCase(Form1.Combo2.Text) = LCase("<" & Lang.PerfilName_Automatic & ">") Then OutExtIsAuto = 1
Call Lang.CargarLenguaje(Nombre)
If OutExtIsAuto = 1 Then
    Form1.Combo2.Text = "<" & Lang.PerfilName_Automatic & ">"
    Form1.Combo2.Tag = "<" & Lang.PerfilName_Automatic & ">"
Else
    Form1.Combo2.Text = Form1.Combo2.Tag
End If
Select Case LCase(Aplicacion.OutputFormat)
    Case Is = "": Form1.Combo3.Text = "<" & Lang.PerfilName_Automatic & ">"
    Case Is = LCase(App.Path & "\appfiles\formats\.lfm"): Form1.Combo3.Text = "<" & Lang.PerfilName_Manual & ">"
End Select
Select Case LCase(Aplicacion.OutputEdit)
    Case Is = "": Form1.Combo4.Text = "<" & Lang.PerfilName_Nothing & ">"
    Case Is = LCase(App.Path & "\appfiles\editp\.lep"): Form1.Combo4.Text = "<" & Lang.PerfilName_Manual & ">"
End Select
End Sub

Private Sub Command7_Click()
Dim i As Integer
If LCase(Lang.LangName) = LCase(LangActual) Then Exit Sub
For i = 0 To Combo1.ListCount - 1
    If LCase(LangActual) = LCase(Combo1.List(i)) Then
        Combo1.ListIndex = i
        Call Command6_Click
        Exit For
    End If
Next
Unload Me
End Sub

Private Sub Command8_Click()
Aceptar = 1
Call Command6_Click
Unload Me
End Sub

Private Sub Form_Load()
Dim Rutas() As String, i As Integer
Rutas = ScriptObj.ListarArchivosDeDir(App.Path & "\appfiles\lang", "llg:")
If Rutas(1) <> "" Then
For i = 1 To UBound(Rutas): Combo1.AddItem ScriptObj.NombreBase(Rutas(i)): Next
End If
For i = 0 To Combo1.ListCount - 1
If LCase(Combo1.List(i)) = LCase(Lang.LangName) Then
Combo1.ListIndex = i
Exit For
End If
Next
If Combo1.ListIndex = -1 Then Combo1.ListIndex = 0
Me.Height = 1665
Picture1.Left = Combo1.Left
Picture1.Top = Combo1.Top
LangActual = Lang.LangName
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Picture1.Visible = True Then
Picture1.Visible = False
Me.Height = 1665
Cancel = 1
Else
    If LCase(Lang.LangName) <> LCase(LangActual) Then
        If Aceptar = 0 Then Call Command7_Click Else Aceptar = 0
    End If
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set Form13 = Nothing
End Sub

Private Sub Text2_Change()
CambioTexto = 1
End Sub
