' Output a file ' If there is no translation then we output the line as a comment ' that starts with #EN# indicating that translation is required Sub Export_File(sType, iCol As Integer) Dim oFile As Integer Dim iRow As Integer Dim iBlankLines As Integer Dim sLangCode As String Dim sOut As String Dim sTemp As String Dim bOut() As Byte Dim shSheet As Worksheet: Set shSheet = Worksheets(sType) sFilename = sType & "_" & LCase$(shSheet.Cells(cLanguageCodeRow, iCol).Value) & ".properties" oFile = FreeFile() sFullPath = Application.ActiveWorkbook.Path & "\" & sFilename On Error Resume Next Kill sFullPath Open sFullPath For Output As #oFile Close #oFile On Error GoTo 0 Open sFullPath For Binary Access Write As #oFile ' Output comment on version as first line sOut = "# " & sFilename & " Generated by calibre2opds localization.xls v" & Worksheets(cConfiguration).Cells(cVersionRow, cVersionCol).Value & vbCrLf bOut = UnicodeToBytes(Worksheets(cConfiguration).Cells(cOutputFormatRow, cOutputFormatCol), sOut) Put #oFile, , bOut iRow = cFirstDataRow Do sTemp = shSheet.Cells(iRow, cKeywordCol).Value sOut = sTemp ' Print #oFile, sTemp; If Len(sTemp) = 0 Then iBlankLines = iBlankLines + 1 Else iBlankLines = 0 If Not isComment(sTemp) Then sOut = sTemp & "=" ' Print #oFile, "="; sTemp = shSheet.Cells(iRow, iCol).Value If Len(sTemp) > 0 Then sOut = sOut & sTemp ' Print #oFile, sTemp; Else ' If no language specific one supplied then ' output English one as a comment starting with '#EN#' ' (as long this is not the english column with empty value) If iCol <> cEnglishLangCol Then sOut = "#EN# " & sOut End If sOut = sOut & shSheet.Cells(iRow, 3).Value ' Print #oFile, shSheet.Cells(iRow, 3).Value; End If End If End If sOut = sOut & vbCrLf bOut = UnicodeToBytes(Worksheets(cConfiguration).Cells(cOutputFormatRow, cOutputFormatCol), sOut) Put #oFile, , bOut ' Print #oFile, "" ' Force new line iRow = iRow + 1 Loop Until (iBlankLines > 5) Close #oFile End Sub