Gtk2::S...Manager(3)

๐Ÿ“ฆ
version 0.12 ยท 2 versions
, in fedora 43

๐Ÿ’– Gtk2::SourceView2::LanguageManager ๐Ÿ’–

okay bestie, gather round, because this one is literally the keeper of all the languages โœจ It's Gtk2::SourceView2::LanguageManager, straight out of the User Contributed Perl Documentation (that's the manual it lives in, for the record ๐ŸŽ€). Think of it as the lil front desk that knows where every language definition file is hiding and can guess what language your file is in like it's reading your aura. ๐Ÿ”ฎ


๐ŸŒˆ HIERARCHY ๐ŸŒˆ

so here's the family tree, and yes it's giving nepo baby but make it Glib:

Glib::Object
+----Gtk2::SourceView2::LanguageManager

โœจ METHODS โœจ

  • languagemanager = Gtk2::SourceView2::LanguageManager->new โ€” makes you a fresh new manager, blank slate, main character energy ๐Ÿ‘‘
  • languagemanager = Gtk2::SourceView2::LanguageManager->get_default โ€” hands you the shared default manager, the one everybody's already using. no need to build your own when the group chat already exists ๐Ÿซถ
  • language or undef = $lm->guess_language ($filename, $content_type=undef) โ€” the vibe check method ๐Ÿ’… give it a filename and it'll guess which language it is. returns the language, or undef if it's not picking up what you're putting down ๐Ÿ˜ญ
    • $filename (string or undef)
    • $content_type (string or undef)
  • language or undef = $lm->get_language ($id) โ€” gimme the language for this exact id, no guessing involved. also can come back undef if that id isn't a thing ๐Ÿ™ˆ
    • $id (string)
  • list = $lm->get_language_ids โ€” the full roster of every language id it's got. the whole squad list ๐Ÿ“‹
  • list = $lm->get_search_path โ€” shows you the list of directories where $lm goes looking for language files. like showing you where it keeps its stuff ๐ŸŽ’
  • $lm->set_search_path (...) โ€” sets that list of directories where the lm looks for language files. ๐Ÿ—บ๏ธ
    • ... (list)
okay so here's the tea โ˜• โ€” if you pass no dirs at all (empty list), the search path gets cleared. But if you pass undef, the search path gets reset to the default. Two very different outcomes, don't mix them up bestie!!
Note: at the moment this function can only be called before the language files are loaded for the first time. In practice, to set a custom search path for a Gtk2::SourceLanguageManager, you have to call this function right after creating it. So do it immediately, no procrastinating, this is a now-or-never situation fr fr ๐Ÿ˜ค

๐ŸŽ€ PROPERTIES ๐ŸŽ€

  • 'language-ids' (Glib::Strv : default undef : readable) โ€” List of the ids of the available languages ๐Ÿ’–
  • 'search-path' (Glib::Strv : default undef : readable / writable) โ€” List of directories where the language specification files (.lang) are located ๐Ÿฆ‹

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

  • Gtk2::SourceView2
  • Glib::Object

go read those too, iykyk ๐ŸŒธ


Copyright (C) 2009 by Emmanuel Rodriguez


and that's the whole page, bestie!! this was brought to you by perl v5.42.0, dated 2025-07-25, and honestly? iconic. slay, periodt, go guess some languages ๐Ÿ’…โœจ๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from