This site uses cookies.
Some of these cookies are essential to the operation of the site,
while others help to improve your experience by providing insights into how the site is being used.
For more information, please see the ProZ.com privacy policy.
use AppleScript version "2.4" -- Yosemite (10.10) or later use framework "Foundation" use scripting additions
set theLangs to {} tell application id "com.apple.iWork.Pages" -- Pages tell document 1 set theParagraphs to paragraphs of body text repeat with i from (count of theParagraphs) to 1 by -1 if length of item i of theParagraphs > 1 then set theLanguage to (my guessLanguageOf:(item i of theParagraphs)) -- will be "en", "de", etc if theLanguage = "en" then delete paragraph i of body text end if end if end repeat end tell end tell
on guessLanguageOf:theString set theTagger to current application's NSLinguisticTagger's alloc()'s initWithTagSchemes:{current application's NSLinguisticTagSchemeLanguage} options:0 theTagger's setString:theString set languageID to theTagger's tagAtIndex:0 |scheme|:(current application's NSLinguisticTagSchemeLanguage) tokenRange:(missing value) sentenceRange:(missing value) return languageID as text end guessLanguageOf:
BTW: Sometimes you want to KEEP paragraphs in a certain language, e.g. German.
Change the equals sign to the ≠ (not equal to) in:
Exclusive discount for ProZ.com users!
Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value
Translate faster & easier, using a sophisticated CAT tool built by a translator / developer.
Accept jobs from clients who use Trados, MemoQ, Wordfast & major CAT tools.
Download and start using CafeTran Espresso -- for free