5. Dezember 2014 13:17
11. Dezember 2014 09:56
Element Page does not support property Unknown
16. Januar 2015 11:00
20. Januar 2015 14:24
26. Juli 2015 12:49
function RemoveAllLang
{
$WorkingFolder1 = "$env:temp\NAVTEMPLANG1"
$WorkingFolder2 = "$env:temp\NAVTEMPLANG2"
$FullReadingPath = resolve-path $args
$ParentReadingPath = (get-item $FullReadingPath).DirectoryName
$ConvertedFileName = [System.IO.Path]::GetFileNameWithoutExtension($args) +"_ENU" + [System.IO.Path]::GetExtension($args)
IF (Test-Path $WorkingFolder1) {Remove-Item $WorkingFolder1\*.txt -recurse}
IF (Test-Path $WorkingFolder2) {Remove-Item $WorkingFolder2\*.txt -recurse}
IF (Test-Path $FullReadingPath)
{
Split-NAVApplicationObjectFile -Source $FullReadingPath -Destination $WorkingFolder1 -Force
Remove-NAVApplicationObjectLanguage -Destination $WorkingFolder1\TEMPLANG1.txt -Source $FullReadingPath -force
Split-NAVApplicationObjectFile -Source $WorkingFolder1\TEMPLANG1.txt -Destination $WorkingFolder2 -Force
Join-NAVApplicationObjectFile -Source $WorkingFolder2\TAB*.txt -Destination $WorkingFolder2\alltables.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\REP*.txt -Destination $WorkingFolder2\allreports.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\COD*.txt -Destination $WorkingFolder2\allcodeunits.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\XML*.txt -Destination $WorkingFolder2\allXMLports.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\MEN*.txt -Destination $WorkingFolder2\allmenusuites.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\PAG*.txt -Destination $WorkingFolder2\allpages.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\QUE*.txt -Destination $WorkingFolder2\allqueries.txt
Write-Host "Concatenating the separate object files into the AllObjects.txt, this may take a while. This file will be copied as $ParentReadingPath\$ConvertedFileName when finished."
IF (Test-Path $WorkingFolder2\alltables.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\alltables.txt)}
IF (Test-Path $WorkingFolder2\allreports.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allreports.txt)}
IF (Test-Path $WorkingFolder2\allcodeunits.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allcodeunits.txt)}
IF (Test-Path $WorkingFolder2\allXMLports.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allXMLports.txt)}
IF (Test-Path $WorkingFolder2\allmenusuites.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allmenusuites.txt)}
IF (Test-Path $WorkingFolder2\allpages.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allpages.txt)}
IF (Test-Path $WorkingFolder2\allqueries.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allqueries.txt)}
IF (Test-Path $WorkingFolder2\alltables.txt) {Remove-Item $WorkingFolder2\alltables.txt}
IF (Test-Path $WorkingFolder2\allreports.txt) {Remove-Item $WorkingFolder2\allreports.txt}
IF (Test-Path $WorkingFolder2\allcodeunits.txt) {Remove-Item $WorkingFolder2\allcodeunits.txt}
IF (Test-Path $WorkingFolder2\allXMLports.txt) {Remove-Item $WorkingFolder2\allXMLports.txt}
IF (Test-Path $WorkingFolder2\allmenusuites.txt) {Remove-Item $WorkingFolder2\allmenusuites.txt}
IF (Test-Path $WorkingFolder2\allpages.txt) {Remove-Item $WorkingFolder2\allpages.txt}
IF (Test-Path $WorkingFolder2\allqueries.txt) {Remove-Item $WorkingFolder2\allqueries.txt}
IF (Test-Path $WorkingFolder2\allobjects.txt) {Copy-Item $WorkingFolder2\AllObjects.txt -destination "$ParentReadingPath\$ConvertedFileName" -force}
}
IF (Test-Path $WorkingFolder1) {Remove-Item $WorkingFolder1 -recurse}
IF (Test-Path $WorkingFolder2) {Remove-Item $WorkingFolder2 -recurse}
}
27. August 2015 22:59
function ImportLangLayer1para
{
[cmdletbinding()]
param(
[string]$ObjFile_ENU)
# Version with single parameter (object file) to save typing if the translations file LNG.txt in the same folder may be re-used with different object packs
If ($ObjFile_ENU -eq '') {THROW 'Path of the object source file is missing.'}
$BasicPath = resolve-path $ObjFile_ENU
$FileParentPath = (get-item $ObjFile_ENU).parent.FullName
# Activate if required (Console)
# Import-Module "C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\NavModelTools.ps1" -force -DisableNameChecking | out-null
$ConvFilePath = [System.IO.Path]::GetDirectoryName($ObjFile_ENU) + "\"+ [System.IO.Path]::GetFileNameWithoutExtension($ObjFile_ENU) + "_CAP" + [System.IO.Path]::GetExtension($ObjFile_ENU)
if (Test-Path $ConvFilePath) {Remove-Item $ConvFilePath}
$WorkingFolder1 = "$env:temp\TEMPLANG1"
$WorkingFolder2 = "$env:temp\TEMPLANG2"
IF (!(Test-Path $WorkingFolder1)) {New-Item $WorkingFolder1 -ItemType Directory}
IF (!(Test-Path $WorkingFolder2)) {New-Item $WorkingFolder2 -ItemType Directory}
$ReadingFolder = [System.IO.Path]::GetDirectoryName($ObjFile_ENU)
IF (Test-Path $WorkingFolder1) {Remove-Item $WorkingFolder1\*.txt -recurse}
IF (Test-Path $WorkingFolder2) {Remove-Item $WorkingFolder2\*.txt -recurse}
IF ((Test-Path $ObjFile_ENU) -and (Test-Path $ReadingFolder\LNG.txt))
{
Import-NAVApplicationObjectLanguage -Destination $WorkingFolder1\TEMPLANG1.txt -LanguagePath $ReadingFolder\LNG.txt -Source $ObjFile_ENU -force
Split-NAVApplicationObjectFile -Source $WorkingFolder1\TEMPLANG1.txt -Destination $WorkingFolder2 -Force -PreserveFormatting
Join-NAVApplicationObjectFile -Source $WorkingFolder2\TAB*.txt -Destination $WorkingFolder2\alltables.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\REP*.txt -Destination $WorkingFolder2\allreports.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\COD*.txt -Destination $WorkingFolder2\allcodeunits.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\XML*.txt -Destination $WorkingFolder2\allXMLports.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\MEN*.txt -Destination $WorkingFolder2\allmenusuites.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\PAG*.txt -Destination $WorkingFolder2\allpages.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\QUE*.txt -Destination $WorkingFolder2\allqueries.txt
Write-Host 'Concatenating the separate object files into the AllObjects.txt, this may take a while.'
IF (Test-Path $WorkingFolder2\alltables.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\alltables.txt)}
IF (Test-Path $WorkingFolder2\allreports.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allreports.txt)}
IF (Test-Path $WorkingFolder2\allcodeunits.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allcodeunits.txt)}
IF (Test-Path $WorkingFolder2\allXMLports.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allXMLports.txt)}
IF (Test-Path $WorkingFolder2\allmenusuites.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allmenusuites.txt)}
IF (Test-Path $WorkingFolder2\allpages.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allpages.txt)}
IF (Test-Path $WorkingFolder2\allqueries.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allqueries.txt)}
IF (Test-Path $WorkingFolder2\alltables.txt) {Remove-Item $WorkingFolder2\alltables.txt}
IF (Test-Path $WorkingFolder2\allreports.txt) {Remove-Item $WorkingFolder2\allreports.txt}
IF (Test-Path $WorkingFolder2\allcodeunits.txt) {Remove-Item $WorkingFolder2\allcodeunits.txt}
IF (Test-Path $WorkingFolder2\allXMLports.txt) {Remove-Item $WorkingFolder2\allXMLports.txt}
IF (Test-Path $WorkingFolder2\allmenusuites.txt) {Remove-Item $WorkingFolder2\allmenusuites.txt}
IF (Test-Path $WorkingFolder2\allpages.txt) {Remove-Item $WorkingFolder2\allpages.txt}
IF (Test-Path $WorkingFolder2\allqueries.txt) {Remove-Item $WorkingFolder2\allqueries.txt}
IF (Test-Path $WorkingFolder2\allobjects.txt) {Copy-Item $WorkingFolder2\AllObjects.txt -destination $ConvFilePath -force}
Write-Host "Using $ObjFile_ENU, captions from LNG.txt were added to form a new object pack: $ConvFilePath"
}
}
28. August 2015 23:50
function ImportLangLayer
{
[cmdletbinding()]
param(
[string]$ObjFile_ENU,
[string]$LanguageFile,
[string]$ConvFilePath
)
# Version with 3 parameters if an optional varying language file or output file is required
# if parameter 2 is missing, a file LNG.txt with the captions must be present in the same folder as the object file
# if parameter 3 is missing, a suffix _CAP will be added to the source object file to form the name of the output file
If ($ObjFile_ENU -eq '') {THROW 'Path of the object source file is missing.'}
$BasicPath = resolve-path $ObjFile_ENU
$FileParentPath = (get-item $ObjFile_ENU).parent.FullName
# Import-Module "C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\NavModelTools.ps1" -force -DisableNameChecking | out-null
if ($ConvFilePath -eq '')
{$ConvFilePath = [System.IO.Path]::GetDirectoryName($ObjFile_ENU) + "\"+ [System.IO.Path]::GetFileNameWithoutExtension($ObjFile_ENU) + "_CAP" + [System.IO.Path]::GetExtension($ObjFile_ENU)}
if (Test-Path $ConvFilePath) {Remove-Item $ConvFilePath}
$WorkingFolder1 = "$env:temp\TEMPLANG1"
$WorkingFolder2 = "$env:temp\TEMPLANG2"
IF (!(Test-Path $WorkingFolder1)) {New-Item $WorkingFolder1 -ItemType Directory}
IF (!(Test-Path $WorkingFolder2)) {New-Item $WorkingFolder2 -ItemType Directory}
$ReadingFolder = [System.IO.Path]::GetDirectoryName($ObjFile_ENU)
if ($LanguageFile -eq '') {$LanguageFile = "$ReadingFolder\LNG.txt"}
IF (Test-Path $WorkingFolder1) {Remove-Item $WorkingFolder1\*.txt -recurse}
IF (Test-Path $WorkingFolder2) {Remove-Item $WorkingFolder2\*.txt -recurse}
IF ((Test-Path $ObjFile_ENU) -and (Test-Path $LanguageFile))
{
Import-NAVApplicationObjectLanguage -Destination $WorkingFolder1\TEMPLANG1.txt -LanguagePath $LanguageFile -Source $ObjFile_ENU -force
Split-NAVApplicationObjectFile -Source $WorkingFolder1\TEMPLANG1.txt -Destination $WorkingFolder2 -Force -PreserveFormatting
Join-NAVApplicationObjectFile -Source $WorkingFolder2\TAB*.txt -Destination $WorkingFolder2\alltables.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\REP*.txt -Destination $WorkingFolder2\allreports.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\COD*.txt -Destination $WorkingFolder2\allcodeunits.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\XML*.txt -Destination $WorkingFolder2\allXMLports.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\MEN*.txt -Destination $WorkingFolder2\allmenusuites.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\PAG*.txt -Destination $WorkingFolder2\allpages.txt
Join-NAVApplicationObjectFile -Source $WorkingFolder2\QUE*.txt -Destination $WorkingFolder2\allqueries.txt
Write-Host 'Concatenating the separate object files into the AllObjects.txt, this may take a while.'
IF (Test-Path $WorkingFolder2\alltables.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\alltables.txt)}
IF (Test-Path $WorkingFolder2\allreports.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allreports.txt)}
IF (Test-Path $WorkingFolder2\allcodeunits.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allcodeunits.txt)}
IF (Test-Path $WorkingFolder2\allXMLports.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allXMLports.txt)}
IF (Test-Path $WorkingFolder2\allmenusuites.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allmenusuites.txt)}
IF (Test-Path $WorkingFolder2\allpages.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allpages.txt)}
IF (Test-Path $WorkingFolder2\allqueries.txt) {Add-Content -path $WorkingFolder2\AllObjects.txt -value(Get-Content $WorkingFolder2\allqueries.txt)}
IF (Test-Path $WorkingFolder2\alltables.txt) {Remove-Item $WorkingFolder2\alltables.txt}
IF (Test-Path $WorkingFolder2\allreports.txt) {Remove-Item $WorkingFolder2\allreports.txt}
IF (Test-Path $WorkingFolder2\allcodeunits.txt) {Remove-Item $WorkingFolder2\allcodeunits.txt}
IF (Test-Path $WorkingFolder2\allXMLports.txt) {Remove-Item $WorkingFolder2\allXMLports.txt}
IF (Test-Path $WorkingFolder2\allmenusuites.txt) {Remove-Item $WorkingFolder2\allmenusuites.txt}
IF (Test-Path $WorkingFolder2\allpages.txt) {Remove-Item $WorkingFolder2\allpages.txt}
IF (Test-Path $WorkingFolder2\allqueries.txt) {Remove-Item $WorkingFolder2\allqueries.txt}
IF (Test-Path $WorkingFolder2\allobjects.txt) {Copy-Item $WorkingFolder2\AllObjects.txt -destination $ConvFilePath -force}
Write-Host "Using $ObjFile_ENU, captions from $LanguageFile were added to form a new object pack: $ConvFilePath"
}
}