Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
feat(i18n): localize Portuguese Finder services and macOS permission prompts
BlackSpirits614845b79ffc
diff --git a/build/build-portable.ps1 b/build/build-portable.ps1index 380a8c6a..629b59a9 100644--- a/build/build-portable.ps1+++ b/build/build-portable.ps1@@ -112,6 +112,9 @@ if ($Runtime.StartsWith('osx-')) {Invoke-Checked 'Create app icon' { iconutil -c icns $iconset -o (Join-Path $resources 'filee.icns') }# Translations of the service title ("Convert with Filee") in Finder's right-click menu.foreach ($localization in Get-ChildItem -LiteralPath (Join-Path $root 'installer/macos') -Directory -Filter '*.lproj') {+ foreach ($stringsFile in Get-ChildItem -LiteralPath $localization.FullName -File -Filter '*.strings') {+ Invoke-Checked 'Validate localized strings' { plutil -lint $stringsFile.FullName }+ }Copy-Item -LiteralPath $localization.FullName -Destination $resources -Recurse}$entitlements = Join-Path $root 'installer/macos/entitlements.plist'diff --git a/installer/macos/Info.plist b/installer/macos/Info.plistindex 2966c7eb..b7f45cb2 100644--- a/installer/macos/Info.plist+++ b/installer/macos/Info.plist@@ -3,7 +3,7 @@<plist version="1.0"><dict><key>CFBundleDevelopmentRegion</key><string>en</string>- <key>CFBundleLocalizations</key><array><string>en</string><string>ko</string><string>zh-Hans</string></array>+ <key>CFBundleLocalizations</key><array><string>en</string><string>ko</string><string>zh-Hans</string><string>pt-PT</string><string>pt-BR</string></array><key>CFBundleIdentifier</key><string>com.filee.app</string><key>CFBundleName</key><string>Filee</string><key>CFBundleDisplayName</key><string>Filee</string>@@ -15,7 +15,7 @@<key>LSMinimumSystemVersion</key><string>13.0</string><key>NSHighResolutionCapable</key><true/><!-- "Convert with Filee" in Finder's right-click menu, answered by the running Filee (MacOSServicesProvider).- ServicesMenu.strings in ko.lproj and zh-Hans.lproj translate the title. An empty NSRequiredContext keeps+ ServicesMenu.strings in each .lproj folder translates the title. An empty NSRequiredContext keepsthe service on by default. --><key>NSServices</key><array>diff --git a/installer/macos/pt-BR.lproj/InfoPlist.strings b/installer/macos/pt-BR.lproj/InfoPlist.stringsnew file mode 100644index 00000000..53192cab--- /dev/null+++ b/installer/macos/pt-BR.lproj/InfoPlist.strings@@ -0,0 +1,3 @@+/* macOS permission explanations; the operating system chooses the bundle localization. */+"NSAppleEventsUsageDescription" = "O Filee lê os arquivos selecionados no Finder quando você usa um atalho de conversão.";+"NSInputMonitoringUsageDescription" = "O Filee detecta o atalho de conversão e o gesto de arrastar para mostrar o menu de conversão.";diff --git a/installer/macos/pt-BR.lproj/ServicesMenu.strings b/installer/macos/pt-BR.lproj/ServicesMenu.stringsnew file mode 100644index 00000000..7df0715b--- /dev/null+++ b/installer/macos/pt-BR.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* Finder's right-click menu: keep the service identifier in English. */+"Convert with Filee" = "Converter com o Filee";diff --git a/installer/macos/pt-PT.lproj/InfoPlist.strings b/installer/macos/pt-PT.lproj/InfoPlist.stringsnew file mode 100644index 00000000..991eecaf--- /dev/null+++ b/installer/macos/pt-PT.lproj/InfoPlist.strings@@ -0,0 +1,3 @@+/* macOS permission explanations; the operating system chooses the bundle localization. */+"NSAppleEventsUsageDescription" = "O Filee lê os ficheiros selecionados no Finder quando utilizas um atalho de conversão.";+"NSInputMonitoringUsageDescription" = "O Filee deteta o atalho de conversão e o gesto de arrastar para mostrar o menu de conversão.";diff --git a/installer/macos/pt-PT.lproj/ServicesMenu.strings b/installer/macos/pt-PT.lproj/ServicesMenu.stringsnew file mode 100644index 00000000..7df0715b--- /dev/null+++ b/installer/macos/pt-PT.lproj/ServicesMenu.strings@@ -0,0 +1,2 @@+/* Finder's right-click menu: keep the service identifier in English. */+"Convert with Filee" = "Converter com o Filee";diff --git a/tests/Filee.Platform.Tests/MacOSIntegrationTests.cs b/tests/Filee.Platform.Tests/MacOSIntegrationTests.csindex 693000d4..1fe2a51f 100644--- a/tests/Filee.Platform.Tests/MacOSIntegrationTests.cs+++ b/tests/Filee.Platform.Tests/MacOSIntegrationTests.cs@@ -1,3 +1,5 @@+using System.Text.Json;+using System.Text.RegularExpressions;using System.Xml.Linq;using Filee.Platform.MacOS;@@ -37,9 +39,43 @@ public sealed class MacOSIntegrationTests// Each translation names the same menu title.foreach (var strings in Directory.GetFiles(installer, "ServicesMenu.strings", SearchOption.AllDirectories))Assert.StartsWith($"\"{MacOSServicesProvider.MenuItem}\" = ", File.ReadAllLines(strings).Single(l => l.StartsWith('"')));- Assert.Equal(3, Directory.GetFiles(installer, "ServicesMenu.strings", SearchOption.AllDirectories).Length);+ var declared = Property(root, "CFBundleLocalizations").Elements("string").Select(x => x.Value).Order();+ var folders = Directory.GetFiles(installer, "ServicesMenu.strings", SearchOption.AllDirectories)+ .Select(path => Path.GetFileNameWithoutExtension(Path.GetDirectoryName(path)!)).Order();+ Assert.Equal(declared, folders);}+ [Theory]+ [InlineData("pt-PT", "ficheiros", "deteta", "arquivos")]+ [InlineData("pt-BR", "arquivos", "detecta", "ficheiros")]+ public void PortugueseNativeTextsKeepTheirVariantAndMatchTheApp(string language, string files, string detects, string otherFiles)+ {+ var repository = RepositoryRoot();+ var installer = Path.Combine(repository, "installer", "macos");+ var root = ReadPlist(File.ReadAllText(Path.Combine(installer, "Info.plist")));+ Assert.Contains(language, Property(root, "CFBundleLocalizations").Elements("string").Select(x => x.Value));+ var folder = Path.Combine(installer, language + ".lproj");+ var menu = ReadStrings(Path.Combine(folder, "ServicesMenu.strings"));+ using var app = JsonDocument.Parse(File.ReadAllText(Path.Combine(repository, "src", "Filee.App", "Assets", "i18n", language + ".json")));+ Assert.Equal(app.RootElement.GetProperty("general.context_menu_label").GetString(), menu[MacOSServicesProvider.MenuItem]);++ var permissions = ReadStrings(Path.Combine(folder, "InfoPlist.strings"));+ Assert.Equal(2, permissions.Count);+ foreach (var (key, value) in permissions)+ {+ Assert.NotEqual(Property(root, key).Value, value);+ Assert.StartsWith("O Filee ", value);+ Assert.True(value.IsNormalized(), $"{language}: {key} is not NFC");+ }+ Assert.Contains(files, permissions["NSAppleEventsUsageDescription"]);+ Assert.DoesNotContain(otherFiles, permissions["NSAppleEventsUsageDescription"]);+ Assert.Contains(detects, permissions["NSInputMonitoringUsageDescription"]);+ }++ private static Dictionary<string, string> ReadStrings(string path) =>+ Regex.Matches(File.ReadAllText(path).ReplaceLineEndings("\n"), "^\"([^\"]+)\" = \"([^\"]+)\";$", RegexOptions.Multiline)+ .ToDictionary(match => match.Groups[1].Value, match => match.Groups[2].Value);+private static string RepositoryRoot(){var folder = new DirectoryInfo(AppContext.BaseDirectory);