Sublime Forum

Advanced highlighting with external list of words

#1

Hey there,

I would like to highlight line break separated words from an ‘external’ text file in Sublime Text.
Background: I’m generating the external text file from a wip translation glossary and I want to see if words in my Sublime Text text are already in the glossary at a glance.
Is there any way to accomplish this in Sublime Text?

Thanks.

0 Likes

#2

The syntax file could likely do something like this, however not automatically. You’d have to write a translation program to take your words in your external file, and generate the language file. It should be relatively straightforward however since the regexp pattern for the words will be well defined.

0 Likes

#3

Thanks for your reply.
Let me elaborate, since I think I was a bit vague:
I have a translation glossary and text files (press releases) on a daily basis that I need to translate.
To build the glossary, I’d have to manually cross reference the daily press releases for technical terms in the glossary which gets more tedious the bigger the glossary gets.
I was looking for a streamlined way to let sublime text compare the source language column in the glossary to the press release I’m working on and have it highlight technical terms that are already existing in the glossary.
That way I know right away which terms I’d need to add to the glossary and which terms I’d have to research using other means since they are not yet existing in the glossary.

Basically I have a word list and a full text and would like to let sublime text check the full text for words that are existing in the list and highlight all of them for me… if this is possible at all.

1 Like

#4

I think this task can be accomplished with a python package with little effort.

  1. You’d need to open a the glossary text file and add all the words you’d like to highlight into a list.
  2. Call view.find_all for each word in that list and merge the results into a second big list.
  3. The resulting list of region's could be passed to view.add_regions() which would underline all found words with correct arguments passed.
2 Likes