mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[loc] set up Windows Store listing translations (part 2)
* Add PowerShell script to generate listing.csv * Also update relevant messages along with French translation
This commit is contained in:
parent
fac433a0fe
commit
3281f6b97e
9 changed files with 818 additions and 248 deletions
151
res/appstore/gen_listing.ps1
Normal file
151
res/appstore/gen_listing.ps1
Normal file
|
@ -0,0 +1,151 @@
|
|||
# PowerShell script to parse rufus.loc and create a listing.csv
|
||||
# Copyright © 2023 Pete Batard <pete@akeo.ie>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
try {
|
||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
} catch {}
|
||||
|
||||
function InsertMsg([object]$translated_msgs, [string]$lang, [string]$msg_id, [string]$msg)
|
||||
{
|
||||
for ($i = 0; $i -lt $translated_msgs.MSG_ID.Count; $i++) {
|
||||
if ($translated_msgs.MSG_ID[$i] -eq $msg_id) {
|
||||
$translated_msgs.$lang[$i] = $msg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function GetMsg([object]$translated_msgs, [string]$lang, [string]$msg_id)
|
||||
{
|
||||
for ($i = 0; $i -lt $translated_msgs.MSG_ID.Count; $i++) {
|
||||
if ($translated_msgs.MSG_ID[$i] -eq $msg_id) {
|
||||
if ($msg_id -eq "MSG_901" -or $msg_id -eq "MSG_902" -or $msg_id -eq "MSG_903") {
|
||||
if (-not $translated_msgs.$lang[$i]) {
|
||||
return $translated_msgs."en-us"[$i]
|
||||
}
|
||||
}
|
||||
return $translated_msgs.$lang[$i]
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
$csv = Import-Csv -Path .\listing_template.csv -Encoding UTF8
|
||||
|
||||
# Get the translated MSG_ID's we need
|
||||
$translated_msg_ids = @()
|
||||
$empty = @()
|
||||
foreach($row in $csv) {
|
||||
# There may be multiple MSG_ID's in the row
|
||||
Select-String "MSG_\d+" -input $row -AllMatches | foreach {
|
||||
foreach ($match in $_.matches) {
|
||||
$translated_msg_ids += $match.Value
|
||||
$empty += ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$translated_msgs = New-Object PSObject
|
||||
Add-Member -InputObject $translated_msgs -NotePropertyName MSG_ID -NotePropertyValue $translated_msg_ids
|
||||
|
||||
$lang = ""
|
||||
$langs = @()
|
||||
foreach ($line in Get-Content ..\loc\rufus.loc) {
|
||||
# Get the language for the current section
|
||||
if ($line -Like "l *") {
|
||||
$lang = $line.split(" ",[System.StringSplitOptions]::RemoveEmptyEntries)[1].Trim('"').ToLower()
|
||||
if ($lang -eq "sr-rs") {
|
||||
$lang = "sr-latn-rs"
|
||||
}
|
||||
$langs += $lang
|
||||
Add-Member -InputObject $translated_msgs -NotePropertyName $lang -NotePropertyValue $empty.PsObject.Copy()
|
||||
}
|
||||
# Add translated messages to our array
|
||||
if ($line -Like "t MSG_*") {
|
||||
$msg_id = $line.Substring(2, 7)
|
||||
if ($translated_msg_ids.Contains($msg_id)) {
|
||||
$msg = $line.Substring(10).Trim('"').Replace("\n","`n").Replace('\"','"')
|
||||
# Insert URLs in the relevant messages
|
||||
if ($msg.Contains("%s")) {
|
||||
$url = switch ($msg_id) {
|
||||
MSG_901 { "https://rufus.ie" }
|
||||
MSG_902 { "https://github.com/pbatard/rufus" }
|
||||
MSG_903 { "https://github.com/pbatard/rufus/blob/master/ChangeLog.txt" }
|
||||
}
|
||||
$msg = $msg.Replace("%s", $url)
|
||||
}
|
||||
InsertMsg $translated_msgs $lang $msg_id "$msg"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Add the extra columns to our CSV
|
||||
foreach ($lang in $langs) {
|
||||
$csv = $csv | Select-Object *, @{ n = $lang; e = " " }
|
||||
}
|
||||
|
||||
# Now insert the translated strings and whatnot
|
||||
foreach($row in $csv) {
|
||||
Select-String "MSG_\d+" -input $row -AllMatches | foreach {
|
||||
foreach ($lang in $langs) {
|
||||
$row.$lang = $row.default
|
||||
foreach ($match in $_.matches) {
|
||||
$msg = GetMsg $translated_msgs $lang $match.Value
|
||||
$row.$lang = $row.$lang.Replace($match.Value, $msg)
|
||||
}
|
||||
}
|
||||
# Override some defaults
|
||||
if ($row.default -eq "MSG_904") {
|
||||
$row.default = "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
} elseif ($row.default -eq "MSG_905") {
|
||||
$row.default = "Boot"
|
||||
} else {
|
||||
$row.default = ""
|
||||
}
|
||||
}
|
||||
if ($row.default -like "<AUTOGENERATED>") {
|
||||
# Insert current year into CopyrightTrademarkInformation
|
||||
if ($row.Field -eq "CopyrightTrademarkInformation") {
|
||||
$year = Get-Date -Format "yyyy"
|
||||
$row.default = "© 2011-" + $year + " Pete Batard"
|
||||
} elseif ($row.Field -eq "ReleaseNotes") {
|
||||
$section = 0
|
||||
$row.default = ""
|
||||
foreach ($line in Get-Content ..\..\ChangeLog.txt) {
|
||||
if ($line.StartsWith("o Version")) {
|
||||
$section++
|
||||
continue
|
||||
}
|
||||
if ($section -eq 1 -and $line) {
|
||||
if ($row.default) {
|
||||
$row.default += "`n"
|
||||
}
|
||||
$row.default += $line.Replace(" ", "• ")
|
||||
}
|
||||
}
|
||||
} elseif ($row.Field.StartsWith("DesktopScreenshot")) {
|
||||
$row.default = ""
|
||||
foreach ($lang in $langs) {
|
||||
$path = $lang + "\" + $row.Field.Replace("Desktop", "") + ".png"
|
||||
if (Test-Path -Path ("listing\" + $path)) {
|
||||
$row.$lang = $path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$csv | Export-Csv 'listing\listing.csv' -NoTypeInformation -Encoding UTF8
|
File diff suppressed because one or more lines are too long
203
res/appstore/listing_template.csv
Normal file
203
res/appstore/listing_template.csv
Normal file
|
@ -0,0 +1,203 @@
|
|||
Field,ID,Type (Type),default
|
||||
Description,2,Text,"MSG_900
|
||||
• MSG_901
|
||||
• MSG_902
|
||||
• MSG_903"
|
||||
ReleaseNotes,3,Text,<AUTOGENERATED>
|
||||
Title,4,Text,Rufus
|
||||
ShortTitle,5,Text,
|
||||
SortTitle,6,Text,
|
||||
VoiceTitle,7,Text,
|
||||
ShortDescription,8,Text,MSG_174
|
||||
DevStudio,9,Text,Pete Batard
|
||||
CopyrightTrademarkInformation,12,Text,<AUTOGENERATED>
|
||||
AdditionalLicenseTerms,13,Text,MSG_904
|
||||
DesktopScreenshot1,100,Relative path (or URL to file in Partner Center),<AUTOGENERATED>
|
||||
DesktopScreenshot2,101,Relative path (or URL to file in Partner Center),<AUTOGENERATED>
|
||||
DesktopScreenshot3,102,Relative path (or URL to file in Partner Center),<AUTOGENERATED>
|
||||
DesktopScreenshot4,103,Relative path (or URL to file in Partner Center),<AUTOGENERATED>
|
||||
DesktopScreenshot5,104,Relative path (or URL to file in Partner Center),
|
||||
DesktopScreenshot6,105,Relative path (or URL to file in Partner Center),
|
||||
DesktopScreenshot7,106,Relative path (or URL to file in Partner Center),
|
||||
DesktopScreenshot8,107,Relative path (or URL to file in Partner Center),
|
||||
DesktopScreenshot9,108,Relative path (or URL to file in Partner Center),
|
||||
DesktopScreenshot10,109,Relative path (or URL to file in Partner Center),
|
||||
DesktopScreenshotCaption1,150,Text,
|
||||
DesktopScreenshotCaption2,151,Text,
|
||||
DesktopScreenshotCaption3,152,Text,
|
||||
DesktopScreenshotCaption4,153,Text,
|
||||
DesktopScreenshotCaption5,154,Text,
|
||||
DesktopScreenshotCaption6,155,Text,
|
||||
DesktopScreenshotCaption7,156,Text,
|
||||
DesktopScreenshotCaption8,157,Text,
|
||||
DesktopScreenshotCaption9,158,Text,
|
||||
DesktopScreenshotCaption10,159,Text,
|
||||
MobileScreenshot1,200,Relative path (or URL to file in Partner Center),
|
||||
MobileScreenshot2,201,Relative path (or URL to file in Partner Center),
|
||||
MobileScreenshot3,202,Relative path (or URL to file in Partner Center),
|
||||
MobileScreenshot4,203,Relative path (or URL to file in Partner Center),
|
||||
MobileScreenshot5,204,Relative path (or URL to file in Partner Center),
|
||||
MobileScreenshot6,205,Relative path (or URL to file in Partner Center),
|
||||
MobileScreenshot7,206,Relative path (or URL to file in Partner Center),
|
||||
MobileScreenshot8,207,Relative path (or URL to file in Partner Center),
|
||||
MobileScreenshot9,208,Relative path (or URL to file in Partner Center),
|
||||
MobileScreenshot10,209,Relative path (or URL to file in Partner Center),
|
||||
MobileScreenshotCaption1,250,Text,
|
||||
MobileScreenshotCaption2,251,Text,
|
||||
MobileScreenshotCaption3,252,Text,
|
||||
MobileScreenshotCaption4,253,Text,
|
||||
MobileScreenshotCaption5,254,Text,
|
||||
MobileScreenshotCaption6,255,Text,
|
||||
MobileScreenshotCaption7,256,Text,
|
||||
MobileScreenshotCaption8,257,Text,
|
||||
MobileScreenshotCaption9,258,Text,
|
||||
MobileScreenshotCaption10,259,Text,
|
||||
XboxScreenshot1,300,Relative path (or URL to file in Partner Center),
|
||||
XboxScreenshot2,301,Relative path (or URL to file in Partner Center),
|
||||
XboxScreenshot3,302,Relative path (or URL to file in Partner Center),
|
||||
XboxScreenshot4,303,Relative path (or URL to file in Partner Center),
|
||||
XboxScreenshot5,304,Relative path (or URL to file in Partner Center),
|
||||
XboxScreenshot6,305,Relative path (or URL to file in Partner Center),
|
||||
XboxScreenshot7,306,Relative path (or URL to file in Partner Center),
|
||||
XboxScreenshot8,307,Relative path (or URL to file in Partner Center),
|
||||
XboxScreenshot9,308,Relative path (or URL to file in Partner Center),
|
||||
XboxScreenshot10,309,Relative path (or URL to file in Partner Center),
|
||||
XboxScreenshotCaption1,350,Text,
|
||||
XboxScreenshotCaption2,351,Text,
|
||||
XboxScreenshotCaption3,352,Text,
|
||||
XboxScreenshotCaption4,353,Text,
|
||||
XboxScreenshotCaption5,354,Text,
|
||||
XboxScreenshotCaption6,355,Text,
|
||||
XboxScreenshotCaption7,356,Text,
|
||||
XboxScreenshotCaption8,357,Text,
|
||||
XboxScreenshotCaption9,358,Text,
|
||||
XboxScreenshotCaption10,359,Text,
|
||||
HolographicScreenshot1,400,Relative path (or URL to file in Partner Center),
|
||||
HolographicScreenshot2,401,Relative path (or URL to file in Partner Center),
|
||||
HolographicScreenshot3,402,Relative path (or URL to file in Partner Center),
|
||||
HolographicScreenshot4,403,Relative path (or URL to file in Partner Center),
|
||||
HolographicScreenshot5,404,Relative path (or URL to file in Partner Center),
|
||||
HolographicScreenshot6,405,Relative path (or URL to file in Partner Center),
|
||||
HolographicScreenshot7,406,Relative path (or URL to file in Partner Center),
|
||||
HolographicScreenshot8,407,Relative path (or URL to file in Partner Center),
|
||||
HolographicScreenshot9,408,Relative path (or URL to file in Partner Center),
|
||||
HolographicScreenshot10,409,Relative path (or URL to file in Partner Center),
|
||||
HolographicScreenshotCaption1,450,Text,
|
||||
HolographicScreenshotCaption2,451,Text,
|
||||
HolographicScreenshotCaption3,452,Text,
|
||||
HolographicScreenshotCaption4,453,Text,
|
||||
HolographicScreenshotCaption5,454,Text,
|
||||
HolographicScreenshotCaption6,455,Text,
|
||||
HolographicScreenshotCaption7,456,Text,
|
||||
HolographicScreenshotCaption8,457,Text,
|
||||
HolographicScreenshotCaption9,458,Text,
|
||||
HolographicScreenshotCaption10,459,Text,
|
||||
StoreLogo720x1080,600,Relative path (or URL to file in Partner Center),
|
||||
StoreLogo1080x1080,601,Relative path (or URL to file in Partner Center),
|
||||
StoreLogo300x300,602,Relative path (or URL to file in Partner Center),
|
||||
OverrideLogosForWin10,603,True/False,FALSE
|
||||
StoreLogoOverride150x150,604,Relative path (or URL to file in Partner Center),
|
||||
StoreLogoOverride71x71,605,Relative path (or URL to file in Partner Center),
|
||||
PromoImage1920x1080,606,Relative path (or URL to file in Partner Center),
|
||||
PromoImage2400x1200,607,Relative path (or URL to file in Partner Center),
|
||||
XboxBrandedKeyArt584x800,608,Relative path (or URL to file in Partner Center),
|
||||
XboxTitledHero1920x1080,609,Relative path (or URL to file in Partner Center),
|
||||
XboxFeaturedPromo1080x1080,610,Relative path (or URL to file in Partner Center),
|
||||
OptionalPromo358x358,611,Relative path (or URL to file in Partner Center),
|
||||
OptionalPromo1000x800,612,Relative path (or URL to file in Partner Center),
|
||||
OptionalPromo414x180,613,Relative path (or URL to file in Partner Center),
|
||||
Feature1,700,Text,MSG_910
|
||||
Feature2,701,Text,MSG_911
|
||||
Feature3,702,Text,MSG_912
|
||||
Feature4,703,Text,MSG_913
|
||||
Feature5,704,Text,MSG_914
|
||||
Feature6,705,Text,MSG_915
|
||||
Feature7,706,Text,MSG_916
|
||||
Feature8,707,Text,MSG_917
|
||||
Feature9,708,Text,MSG_918
|
||||
Feature10,709,Text,MSG_919
|
||||
Feature11,710,Text,MSG_920
|
||||
Feature12,711,Text,MSG_921
|
||||
Feature13,712,Text,MSG_922
|
||||
Feature14,713,Text,
|
||||
Feature15,714,Text,
|
||||
Feature16,715,Text,
|
||||
Feature17,716,Text,
|
||||
Feature18,717,Text,
|
||||
Feature19,718,Text,
|
||||
Feature20,719,Text,
|
||||
MinimumHardwareReq1,800,Text,
|
||||
MinimumHardwareReq2,801,Text,
|
||||
MinimumHardwareReq3,802,Text,
|
||||
MinimumHardwareReq4,803,Text,
|
||||
MinimumHardwareReq5,804,Text,
|
||||
MinimumHardwareReq6,805,Text,
|
||||
MinimumHardwareReq7,806,Text,
|
||||
MinimumHardwareReq8,807,Text,
|
||||
MinimumHardwareReq9,808,Text,
|
||||
MinimumHardwareReq10,809,Text,
|
||||
MinimumHardwareReq11,810,Text,
|
||||
RecommendedHardwareReq1,850,Text,
|
||||
RecommendedHardwareReq2,851,Text,
|
||||
RecommendedHardwareReq3,852,Text,
|
||||
RecommendedHardwareReq4,853,Text,
|
||||
RecommendedHardwareReq5,854,Text,
|
||||
RecommendedHardwareReq6,855,Text,
|
||||
RecommendedHardwareReq7,856,Text,
|
||||
RecommendedHardwareReq8,857,Text,
|
||||
RecommendedHardwareReq9,858,Text,
|
||||
RecommendedHardwareReq10,859,Text,
|
||||
RecommendedHardwareReq11,860,Text,
|
||||
SearchTerm1,900,Text,MSG_905
|
||||
SearchTerm2,901,Text,USB
|
||||
SearchTerm3,902,Text,ISO
|
||||
SearchTerm4,903,Text,Windows
|
||||
SearchTerm5,904,Text,Linux
|
||||
SearchTerm6,905,Text,UEFI
|
||||
SearchTerm7,906,Text,Windows To Go
|
||||
TrailerToPlayAtTopOfListing,999,Relative path (or URL to file in Partner Center),
|
||||
Trailer1,1000,Relative path (or URL to file in Partner Center),
|
||||
Trailer2,1001,Relative path (or URL to file in Partner Center),
|
||||
Trailer3,1002,Relative path (or URL to file in Partner Center),
|
||||
Trailer4,1003,Relative path (or URL to file in Partner Center),
|
||||
Trailer5,1004,Relative path (or URL to file in Partner Center),
|
||||
Trailer6,1005,Relative path (or URL to file in Partner Center),
|
||||
Trailer7,1006,Relative path (or URL to file in Partner Center),
|
||||
Trailer8,1007,Relative path (or URL to file in Partner Center),
|
||||
Trailer9,1008,Relative path (or URL to file in Partner Center),
|
||||
Trailer10,1009,Relative path (or URL to file in Partner Center),
|
||||
Trailer11,1010,Relative path (or URL to file in Partner Center),
|
||||
Trailer12,1011,Relative path (or URL to file in Partner Center),
|
||||
Trailer13,1012,Relative path (or URL to file in Partner Center),
|
||||
Trailer14,1013,Relative path (or URL to file in Partner Center),
|
||||
Trailer15,1014,Relative path (or URL to file in Partner Center),
|
||||
TrailerTitle1,1020,Text,
|
||||
TrailerTitle2,1021,Text,
|
||||
TrailerTitle3,1022,Text,
|
||||
TrailerTitle4,1023,Text,
|
||||
TrailerTitle5,1024,Text,
|
||||
TrailerTitle6,1025,Text,
|
||||
TrailerTitle7,1026,Text,
|
||||
TrailerTitle8,1027,Text,
|
||||
TrailerTitle9,1028,Text,
|
||||
TrailerTitle10,1029,Text,
|
||||
TrailerTitle11,1030,Text,
|
||||
TrailerTitle12,1031,Text,
|
||||
TrailerTitle13,1032,Text,
|
||||
TrailerTitle14,1033,Text,
|
||||
TrailerTitle15,1034,Text,
|
||||
TrailerThumbnail1,1040,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail2,1041,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail3,1042,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail4,1043,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail5,1044,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail6,1045,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail7,1046,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail8,1047,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail9,1048,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail10,1049,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail11,1050,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail12,1051,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail13,1052,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail14,1053,Relative path (or URL to file in Partner Center),
|
||||
TrailerThumbnail15,1054,Relative path (or URL to file in Partner Center),
|
|
|
@ -1,4 +1,19 @@
|
|||
# PowerShell script to parse listing.csv and retrieve our screenshots
|
||||
# Copyright © 2023 Pete Batard <pete@akeo.ie>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
try {
|
||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
} catch {}
|
Loading…
Add table
Add a link
Reference in a new issue