-
Notifications
You must be signed in to change notification settings - Fork 15
/
update-localization.ps1
41 lines (33 loc) · 1.34 KB
/
update-localization.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$localizer = ".\FluentLauncher.Localization\build.bat"
# Check if localizer exists
if (-not (Test-Path $localizer)) {
Write-Host "Localization tool not found! Check the localization project submodule."
exit
}
# Check modification dates
# Function to get the most recent modification date in a directory
function Get-MostRecentModificationDate {
param (
[string]$path
)
Get-ChildItem -Path $path -Recurse |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1 -ExpandProperty LastWriteTime
}
# Get the most recent modification dates
$latestViewsDate = Get-MostRecentModificationDate -path ".\FluentLauncher.Localization\Views"
$latestStringsDate = Get-MostRecentModificationDate -path ".\Natsurainko.FluentLauncher\Strings"
# Compare dates and exit if no compilation is needed
if ($latestStringsDate -ge $latestViewsDate) {
Write-Host "Skipped generation of resw files. Translations are up-to-date."
exit
}
# Change directory and call build.bat
Set-Location .\FluentLauncher.Localization
Write-Output `n | & ".\build.bat"
# Copy resw files generated to the FluentLauncher project
$source = Join-Path (Get-Location) "Strings"
$target = Join-Path $PSScriptRoot "Natsurainko.FluentLauncher"
Copy-Item -Path $source -Destination $target -Recurse -Force
# Display message
Write-Host "COPIED $source TO $target"