Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dutch translations 2021-12-22 #1455

Merged
merged 5 commits into from
Dec 23, 2021
Merged

Update Dutch translations 2021-12-22 #1455

merged 5 commits into from
Dec 23, 2021

Conversation

RockyTDR
Copy link
Contributor

Update Dutch translations according to English source file updates

  • Installer/Languages.iss
  • Sandboxie/msgs/Text-Dutch-1043.txt
  • SandboxiePlus/SandMan/sandman_nl.ts

* Update Languages.iss

* Update Text-Dutch-1043.txt

* Update sandman_nl.ts (#1)
@mpheath
Copy link
Collaborator

mpheath commented Dec 23, 2021

@RockyTDR,

I used a script to get the Classics strings for the new custom messages in Languages.iss. If you improve these strings in Languages.iss, then the referenced Classic strings can receive the improvements as well.

AutoIt3 script for getting Classic strings for Languages.iss
Global $aTargets[5][2] = [ _
    ['3690', 'AddSandboxedBrowser'], _ ; Add desktop shortcut for starting Web browser under Sandboxie
    ['8021', 'SandboxieStartMenu1'], _ ; Run any program sandboxed
    ['8025', 'SandboxieStartMenu2'], _ ; Run Web browser sandboxed
    ['8023', 'SandboxieStartMenu3'], _ ; Sandboxie Start Menu
    ['3698', 'SandboxedBrowser']]      ; Sandboxed Web Browser

; Change working directory.
If Not FileChangeDir('Sandboxie\Sandboxie\msgs') Then
    ConsoleWrite('Failed to change directory' & @CRLF)
    Exit 1
EndIf

; English file to process first.
$sEnglishFile = 'Sbie-English-1033.txt'

; Get the search handle of the language files.
$hFind = FileFindFirstFile('Text-*-*.txt')

While 1

    ; Get language name and language code from the filename.
    If $sEnglishFile Then
        $sFound = $sEnglishFile
        $sEnglishFile = ''

        If Not FileExists($sFound) Then
            ContinueLoop
        EndIf

        $sLangName = 'English'
        $sLangCode = '1033'
    Else
        $sFound = FileFindNextFile($hFind)
        If @error Then ExitLoop

        $aID = StringRegExp($sFound, '(?i)Text-(\w+)-(\d+)\.txt', 3)
        If @error Then ContinueLoop

        $sLangName = $aID[0]
        $sLangCode = $aID[1]
    EndIf

    ; Modify language names.
    Switch $sLangName
        Case 'tradchinese'
            $sLangName = 'ChineseTraditional'
        Case 'simpchinese'
            $sLangName = 'ChineseSimplified'
        Case 'Portuguese'
            $sLangName = 'PortugueseMain'
        Case 'PortugueseBr'
            $sLangName = 'Portuguese'
    EndSwitch

    ; Read language file.
    $sContent = FileRead($sFound)

    ; Open languages.txt for write.
    $hFile = FileOpen(@ScriptDir & '\languages.txt', 0x1 + FileGetEncoding($sFound))

    If $hFile = -1 Then
        ContinueLoop
    EndIf

    ; Write language name as a comment line.
    FileWriteLine($hFile, '; ' & $sLangName)

    ; Get the strings and write to file.
    For $i1 = 0 To UBound($aTargets) - 1
        $sPattern = '(?m)^' & $aTargets[$i1][0] & ';\w+;\d+\R(.*?)\R\.\R'

        $aStrings = StringRegExp($sContent, $sPattern, 3)

        If @error Then
            ConsoleWrite($sLangName & ' Target: "' & $i1 & '" Error:' & @error & @CRLF)
            ContinueLoop
        EndIf

        $sString = StringStripWS($aStrings[0], 3)

        $sString = StringRegExpReplace($sString, '\.lnk$', '')

        $sOutput = StringFormat('%s.%s=%s', StringLower($sLangName), $aTargets[$i1][1], $sString)

        FileWriteLine($hFile, $sOutput & @CRLF)
    Next

    ; Write an empty line as a separator and then close the file.
    FileWriteLine($hFile, @CRLF)
    FileClose($hFile)
WEnd

; Close the search handle.
FileClose($hFind)

This script gets all of the strings specified at the top of the script from the Classic language files. It writes them so the languages of interest can basically be copied into Languages.iss as is.

@RockyTDR
Copy link
Contributor Author

@isaak654 @mpheath
I updated the referenced strings so they are both the same in Text-Dutch-1043.txt and Languages.iss. Thanks for the info.

@mpheath does this mean that I don't need to update the Languages.iss file any more? That would be good news, because right now I'm keeping the Sandboxie Plus and Classic language files up to date with Transifex. However, the Languages.iss isn't compatible with Transifex... 😅

@isaak654 isaak654 merged commit 60afdaa into sandboxie-plus:master Dec 23, 2021
@RockyTDR RockyTDR deleted the Updated-Dutch-Translations-2021-12-22 branch December 23, 2021 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants