Asking for help creating a PopClip extension that removes Catalan accents and diaeresis

Hi!
I’m from Barcelona and I often work with Catalan text. Some Catalan accented vowels and diaeresis characters cause issues in Adobe Acrobat and a few other apps, so I frequently need to convert them to plain ASCII equivalents.

I’d like to ask if it would be possible to create a PopClip extension that performs these replacements:

à → a
è → e
ò → o
é → e
í → i
ó → o
ú → u
ï → i
ü → u

À → A
È → E
Ò → O
É → E
Í → I
Ó → O
Ú → U
Ï → I
Ü → U

The goal is simply to strip accents and diaeresis from these specific Catalan characters.

Is this feasible as a PopClip extension? Any guidance or help would be greatly appreciated.

Thanks!
Gracias!

This is rather easy brute force method in Javascript, below test code implemented in Drafts (sorry I have only iPad here). I can change this to full PopClip solution later if you want.

value = draft.content
 
 value = value.replace(/à/,"a");
 value = value.replace(/è/,"e")
 value = value.replace(/ò/,"o")
 value = value.replace(/é/,"e")
 value = value.replace(/í/,"i")
 value = value.replace(/ó/,"o")
 value = value.replace(/ú/,"u")
 value = value.replace(/ï/,"i")
 value = value.replace(/ü/,"u")
 
 value = value.replace(/À/,"A")
 value = value.replace(/È/,"E")
 value = value.replace(/Ò/,"O")
 value = value.replace(/É/,"E")
 value = value.replace(/Í/,"I")
 value = value.replace(/Ó/,"O")
 value = value.replace(/Ú/,"U")
 value = value.replace(/Ï/,"I")
 value = value.replace(/Ü/,"U")

 draft.content = value

Below is simple implementation. Select text, call translation and text will be replaced with replacement.

@nick - it seems to be problem with replaceAll() method, I don’t have time to diagnose, but using that function returns some errors.

// #popclip
// name: TranslateCatalan
// icon: →
// language: javascript
// description: Translate Catalan characters to pure ASCII

// Created by Nutilius

let value = popclip.input.text;

value = value.replace(/à/g,"a")
value = value.replace(/è/g,"e")
value = value.replace(/ò/g,"o")
value = value.replace(/é/g,"e")
value = value.replace(/í/g,"i")
value = value.replace(/ó/g,"o")
value = value.replace(/ú/g,"u")
value = value.replace(/ï/g,"i")
value = value.replace(/ü/g,"u")

value = value.replace(/À/g,"A")
value = value.replace(/È/g,"E")
value = value.replace(/Ò/g,"O")
value = value.replace(/É/g,"E")
value = value.replace(/Í/g,"I")
value = value.replace(/Ó/g,"O")
value = value.replace(/Ú/g,"U")
value = value.replace(/Ï/g,"I")
value = value.replace(/Ü/g,"U")

popclip.pasteText(value); 

2 Likes

Thanks, this is very helpful.

I only need these 4 Catalan characters and their uppercase versions:

à → a
è → e
ò → o
ï → i

À → A
È → E
Ò → O
Ï → I

I’m still not very familiar with creating PopClip extensions, so if this can be turned into a ready-to-install PopClip snippet, that would help me a lot.

Also, would “Catalan ASCII 4” be a good name for it?

Thank you very much.

Hi @franctastic, to install the extension, you select the text and then click the button that appears like this:

CleanShot 2026-03-13 at 07.23.17

And also adjust the extension yourself, for example, to change the name, or I think you can see in the code where you can remove lines or change which characters are replaced.

1 Like