At last I found the resources containing the strings which weren’t localized in message #17.
I edited the message accordingly.
To find these resources I used a script finalized with the help of Shane Stanley.
Here it is :
-- Dialog Toolkit Plus.scptd should be in ~/Library/Script Libraries
use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
use script "Dialog Toolkit Plus" version "1.1.0"
property |NSURL| : a reference to current application's NSURL
script o
property theLanguages : missing value
property exactMatch : missing value
end script
on searchIn:targetDir forValue:aValue
set reportName to "matches_sehctam.txt"
set targetFile to (path to desktop as text) & reportName
my writeto(targetFile, "theValue" & tab & "theKey" & tab & "HfsPath" & linefeed, «class utf8», false) # create a report
set theFolderURL to current application's NSURL's fileURLWithPath:(POSIX path of targetDir)
set NSFileManager to a reference to current application's NSFileManager's defaultManager()
set theOptions to (current application's NSDirectoryEnumerationSkipsHiddenFiles as integer)
set theURLs to (NSFileManager's enumeratorAtURL:theFolderURL includingPropertiesForKeys:{} options:theOptions errorHandler:(missing value))'s allObjects()
if theURLs is equal to missing value then error (theError's localizedDescription() as text)
repeat with aURL in theURLs
set aName to (aURL's lastPathComponent()) as text
if aName is in o's theLanguages then
# Here we have the searched language lproj name
set someURLs to (NSFileManager's enumeratorAtURL:aURL includingPropertiesForKeys:{} options:theOptions errorHandler:(missing value))'s allObjects()
if someURLs is not equal to missing value then
set englishResAvailable to false
--set englishURL to missing value
repeat with anURL in someURLs
if anURL's pathExtension() as text is "strings" then
set theDict to (current application's NSDictionary's dictionaryWithContentsOfURL:anURL)
if theDict is not missing value then
set theKeys to theDict's allKeys()
repeat with akey in theKeys
try
set theValue to (theDict's valueForKey:akey) # NSString
if o's exactMatch then
set matching to (theValue as text = aValue)
else
set matching to (theValue as text) contains aValue
end if
if matching then
if not englishResAvailable then
# Build the path of the English proj
set frenchPath to anURL as text
set englishPath to (my replace:frenchPath origString:aName newString:"en.lproj")
set englishURL to (|NSURL|'s fileURLWithPath:(POSIX path of englishPath))
if (englishURL's checkResourceIsReachableAndReturnError:(missing value)) as boolean then
set englishResAvailable to true
else
set englishPath to (my replace:frenchPath origString:aName newString:"English.lproj")
set englishURL to (|NSURL|'s fileURLWithPath:(POSIX path of englishPath))
if (englishURL's checkResourceIsReachableAndReturnError:(missing value)) as boolean then
set englishResAvailable to true
end if
end if
end if
if englishResAvailable then
set englishDict to (current application's NSDictionary's dictionaryWithContentsOfURL:englishURL)
set englishValue to (englishDict's valueForKey:(akey as text))
if englishValue is missing value then
set englishValue to "ENGLISH KEY UNAVAILABLE"
else
set englishValue to englishValue as text
end if
else
set englishValue to "ENGLISH lproj UNAVAILABLE"
end if
if aName is in {"en.lproj", "English.lproj"} then
set theData to (theValue as text) & tab & akey & tab & anURL & linefeed
else
set theData to (theValue as text) & tab & akey & tab & englishValue & tab & anURL & linefeed
end if
my writeto(targetFile, theData, «class utf8», true) # create a report
end if
(*
on error
# we met a key like "@1 isn't scriptable."
set theData to ">>>>>>>>>>>>>>" & tab & akey & tab & anURL & linefeed
my writeto(targetFile, theData, «class utf8», true) # create a report
*)
end try
end repeat
end if
end if
end repeat
end if
end if
end repeat
tell application "TextEdit"
activate
if exists window reportName then close window reportName
open file targetFile
end tell
end searchIn:forValue:
#=====
(*
Handler borrowed to Regulus6633 - http://macscripter.net/viewtopic.php?id=36861
*)
on writeto(targetFile, theData, dataType, apendData)
-- targetFile is the path to the file you want to write
-- theData is the data you want in the file.
-- dataType is the data type of theData and it can be text, list, record etc.
-- apendData is true to append theData to the end of the current contents of the file or false to overwrite it
try
set targetFile to targetFile as «class furl»
set openFile to open for access targetFile with write permission
if not apendData then set eof of openFile to 0
write theData to openFile starting at eof as dataType
close access openFile
return true
on error
try
close access file targetFile
end try
return false
end try
end writeto
#=====
on replace:sourceString origString:d1 newString:d2
set sourceString to current application's NSString's stringWithString:sourceString
set anArray to (sourceString's componentsSeparatedByString:d1)
set newString to (anArray's componentsJoinedByString:d2) as text
return newString
end replace:origString:newString:
#=====
my germaine()
on germaine()
set accViewWidth to 400
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
set btnOther to "French" # Edit to fit your needs
set otherLanguages to {"fr.lproj", "French.lproj"} # Edit to fit your needs
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
set btnEnglish to "English"
set btnCancel to "Cancel"
set {theButtons, minWidth} to create buttons {btnCancel, btnEnglish, btnOther} default button btnOther cancel button btnCancel with equal widths
if minWidth > accViewWidth then set accViewWidth to minWidth -- make sure buttons fit
-- to make it look better, we can get the length of the longest label we will use, and use that to align the controls
set theLabelStrings to {"Search in:", "Text to search:"}
set maxLabelWidth to max width for labels theLabelStrings
set controlLeft to maxLabelWidth + 8
set theTop to -8
-- start from the bottom with a checkbox
# box checked --> return strings equal to the searched string -- default setting
# box unchecked --> return strings containing the searched string
set {theCheckbox, theTop, newWidth} to create checkbox "Exact match" left inset controlLeft bottom (theTop + 8) max width accViewWidth with initial state
-- then a labeled popup to define the location where we will search
set inSystemFolder to "Library from System folder"
set inApplications to "Applications folder"
set inPrefPanes to "PreferencePanes folder"
set inResources to "Folder Resources on the Desktop"
set {locationPopup, popupLabel, theTop} to create labeled popup {inSystemFolder, inApplications, inPrefPanes, inResources} left inset 0 bottom (theTop + 8) popup width 250 max width accViewWidth label text (theLabelStrings's item 1) popup left controlLeft initial choice inResources
# Define the string to search
set {searchField, searchLabel, theTop, fieldLeft} to create side labeled field "Réseau" placeholder text "Searched text" left inset 0 bottom (theTop + 12) total width accViewWidth label text (theLabelStrings's item 2) field left controlLeft
-- make list of controls and pass to display command
set allControls to {theCheckbox, locationPopup, popupLabel, searchField, searchLabel}
-- controlResults will be in the same order as allControls
set {buttonName, controlsResults} to display enhanced window "Search in resources" acc view width accViewWidth acc view height theTop acc view controls allControls buttons theButtons initial position {100, 30} with align cancel button
set {matchBoolean, searchWhere, unused, aValue, unused} to controlsResults
if buttonName is btnEnglish then # search in English resources
set o's theLanguages to {"en.lproj", "English.lproj"}
else # search in other language resources
set o's theLanguages to otherLanguages
end if
set o's exactMatch to matchBoolean
if searchWhere is inSystemFolder then
set targetDir to path to library folder from system domain
else if searchWhere is inApplications then
set targetDir to path to applications folder from local domain
else if searchWhere is inPrefPanes then
set targetDir to (path to library folder from system domain as text) & "PreferencePanes:"
else
set targetDir to (path to desktop as text) & "Resources:"
end if
my searchIn:targetDir forValue:aValue
end germaine
As you know I am unable to test it under 10.14 or 10.15.
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 9 décembre 2019 18:23:50
Edited to give it a neat interface
New enhancements. When the searched language is not English, the script return infos about the availability of the English version of the searched string.