Skip to content

Commit

Permalink
Merge pull request #35 from ovari/master
Browse files Browse the repository at this point in the history
Add hu (Hungarian - magyar) locale
  • Loading branch information
jmzambon authored Aug 27, 2024
2 parents 56e31ed + 0d7f522 commit 533657a
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 26 deletions.
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
# Code Highlighter 2
Code snippet highlighter for LibreOffice.
Code snippet highlighter for LibreOffice Writer, Calc, Impress and Draw.

Code Highlighter 2 is a forked of [Code Highlighter](https://github.com/slgobinath/libreoffice-code-highlighter), originally created by slgobinath but no more maintained.
Code Highlighter 2 is a fork of [Code Highlighter](https://github.com/slgobinath/libreoffice-code-highlighter), originally created by [slgobinath](https://github.com/slgobinath) and no longer maintained.

Code Highlighter 2 is built upon [Pygments](https://pygments.org/) python library.
Code Highlighter 2 is built upon [Pygments](https://pygments.org/) Python library.

## INSTALLATION

> If you get an error message at installation time, try to uninstall any previous version of Code Highlighter, then restart LibreOffice and reinstall the extension.
### Install Dependencies (Linux Users)
**Note: Close all the LibreOffice products before installing the dependencies**
**Note: Close all LibreOffice applications before installing the dependencies**

Install libreoffice-script-provider-python
```
sudo apt-get install libreoffice-script-provider-python
```
The above command is for Ubuntu and its derivatives. Other Linux users, may not need this package.
If you encounter any problems after installing the extension, please check whether you have this or similar package.
If you encounter any problems after installing the extension, please check whether you have this or a similar package.

### Install Extension
Open LibreOffice, go to `Tools` -> `Extension Manager...` and add the extension `codehighlighter2.oxt`
Open LibreOffice, go to `Tools` `Extension` and add the extension `codehighlighter2.oxt`

You can download the extension either from the official LibreOffice extensions page or from the [Github repository](https://github.com/jmzambon/libreoffice-code-highlighter) (_codehighlighter2.oxt_ file).
You can download the extension either from the [official LibreOffice Extensions page](https://extensions.libreoffice.org/en/extensions/show/5814) or from the [GitHub repository](https://github.com/jmzambon/libreoffice-code-highlighter) (_codehighlighter2.oxt_ file).

## USAGE
- Open a LibreOffice document.
- Open a LibreOffice Writer document, Calc spreadsheet, Impress presentation, or Draw drawing.
- Copy and paste any code snippet where you want it
- **Writer**: either in a text frame (preferred option), in a text box, in a table cell or even as plain text
- **Calc**: either in cell or in a text box
- **Impress** and **Draw**: in a text box
- Select the object or the text containing the code snippet.
- *Format -> Code Highlighter 2 -> Highlight Code*
- *Format Code Highlighter 2 Highlight Code*
- in the dialog: select the language, the style and side parameters if needed
- or *Format -> Code Highlighter 2 -> Highlight Code (previous settings)*
- or *Format Code Highlighter 2 Highlight Code (previous settings)*
- does not open a dialog, but applies previous settings (persistent also between restarts of LO)
- or *Format -> Code Highlighter 2 -> Update selection*
- or *Format Code Highlighter 2 Update selection*
- updates an already highlighted snippet with the formatting informations stored with it

#### Alternatively (Writer only)
- Format all your snippets with a dedicated paragraph style.
- Choose *Format -> Code Highlighter 2 -> Highlight Code*.
- Choose *Format Code Highlighter 2 Highlight Code*.
- Select the paragraph style and press *Highlight all*.

#### Features
- Supports all languages (more then 500) and styles (more then 40) provided by Pygments.
- Supports all languages (more than 500) and styles (more than 40) provided by Pygments.
- Supports multiselection.
- Supports line numbering.
- Supports all modules excepted Base.
- Supports direct formatting or character styles.
- Allow to disable background color.
- Allow in-document preview [2.4.11].

#### General behaviour
- Highlighting is applied to the selected object, that can be plain text, text frame, text shape, text table cell or calc cell.
#### General behavior
- Highlighting is applied to the selected object, that can be plain text, text frame, text shape, text table cell or Calc spreadsheet cell.
- Highlight properties are hard-formatted for each token, parsed according to the choosen Pygments lexer (aka coding language). If someone prefers instead to make use of character styles, select the corresponding option in the dialog box (from v2.3.0, Writer only).
- When cursor is inside a text shape or a Calc cell, highlighting is applied to the whole shape or cell even if only a part of the text is selected.
- When cursor is inside a text frame, a text table cell or an already highlighted plain text*, highlighting is only applied to the selected text if any, otherwise to the whole frame, cell or plain text snippet.
- When highlighting applies to the selected text, it formats the entire paragraphs, even if selection starts after the paragraph start or ends before paragraph end, unless the selection is an inline snippet.
- Choosing "Update selection", the program will update highlighted code keeping the already applied options. If nothing is selected and the cursor is inside an already highlighted block, the whole block will be updated*.
- Choosing Update selection, the program will update highlighted code keeping the already applied options. If nothing is selected and the cursor is inside an already highlighted block, the whole block will be updated*.

<sub>\* To allow code update, Code Highlighter 2 stores the formatting options in the document as [User Defined Attributes](https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1xml_1_1UserDefinedAttributesSupplier.html#a7c8de9b61fff54bb35d4203618828f32). If you're not comfortable with that, you can disable it by setting the 'StoreOptionsWithSnippet' option to 0 in advanced options (Options-> Advanced-> Open Expert Configuration-> ooo.ext.code-highlighter.Registry).</sub>
<sub>\* To allow code update, Code Highlighter 2 stores the formatting options in the document as [User Defined Attributes](https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1xml_1_1UserDefinedAttributesSupplier.html#a7c8de9b61fff54bb35d4203618828f32). If you are not comfortable with that, you can disable it by setting the 'StoreOptionsWithSnippet' option to 0 in advanced options (OptionsAdvancedOpen Expert Configuration ooo.ext.code-highlighter.Registry).</sub>

#### Tips
- CodeHighlighter2 contains two styles that are not part of Pygments: libreoffice-classic and libreoffice-dark, that make use of LibreOffice IDE color schemes (classic mode and dark mode). Code Highlighter also adds a "LibreOffice Basic" language, which is not a Pygments lexer but a convenient shortcut to VB.net lexer, which is perfect for parsing LOBasic.
- Not all language aliases that are valid names for Code Highlighter 2 appear in the option dialog: if you don't find a language, try anyway to type its name in the combobox (try for example with "R" or with "Pascal").
- Choose "automatic" to highlight from different languages at the same time.
- Click the "More..." button to access line numbers options or character styles options.
- CodeHighlighter2 contains two styles that are not part of Pygments: libreoffice-classic and libreoffice-dark, that make use of LibreOffice IDE color schemes (classic mode and dark mode). Code Highlighter also adds a LibreOffice Basic language, which is not a Pygments lexer but a convenient shortcut to VB.net lexer, which is perfect for parsing LOBasic.
- Not all language aliases that are valid names for Code Highlighter 2 appear in the option dialog: if you are unable to find a language, try anyway to type its name in the combobox (try for example with “R” or with Pascal).
- Choose automatic to highlight from different languages at the same time.
- Click the More…” button to access line numbers options or character styles options.
- Uncheck line numbering option to remove unwanted line numbers, due for example to copy-pasted code.
- For long snippet, CodeHighlighter2 works faster with text and text frame in Writer.

## Screenshots
*Menu items (Writer)*
### Menu items (Writer)

![Menu](screenshots/code-highlighter-menu.png?raw=true "Menu")

*Dialog*
### Dialog

![Dialog](screenshots/code-highlighter-dialog.png?raw=true "Dialog")

*Result*
### Result

![Result](screenshots/code-highlighter-result.png?raw=true "Result")

Expand Down
8 changes: 8 additions & 0 deletions codehighlighter/Addons.xcu
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en">Code Highlighter 2</value>
<value xml:lang="fr">Code Highlighter 2</value>
<value xml:lang="hu">Kódkiemelő 2</value>
<value xml:lang="it">Code Highlighter 2</value>
</prop>
<node oor:name="Submenu">
<node oor:name="ch2-4" oor:op="replace">
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en">Highlight Code</value>
<value xml:lang="fr">Colorer le code</value>
<value xml:lang="hu">Kódkiemelés</value>
<value xml:lang="it">Colora il codice</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
Expand All @@ -68,6 +70,7 @@
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en">Highlight Code (previous settings)</value>
<value xml:lang="fr">Colorer le code (choix précédents)</value>
<value xml:lang="hu">Kódkiemelés (korábbi beállítások)</value>
<value xml:lang="it">Colora il codice (scelte precedenti)</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
Expand All @@ -81,6 +84,7 @@
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en">Update selection</value>
<value xml:lang="fr">Actualiser la sélection</value>
<value xml:lang="hu">Kijelölés frissítése</value>
<value xml:lang="it">Aggiorna la selezione</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
Expand Down Expand Up @@ -124,13 +128,15 @@
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en">Code Highlighter 2</value>
<value xml:lang="fr">Code Highlighter 2</value>
<value xml:lang="hu">Kódkiemelő 2</value>
<value xml:lang="it">Code Highlighter 2</value>
</prop>
<node oor:name="Submenu">
<node oor:name="ch2-4" oor:op="replace">
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en">Highlight Code</value>
<value xml:lang="fr">Colorer le code</value>
<value xml:lang="hu">Kódkiemelés</value>
<value xml:lang="it">Colora il codice</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
Expand All @@ -144,6 +150,7 @@
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en">Highlight Code (previous settings)</value>
<value xml:lang="fr">Colorer le code (choix précédents)</value>
<value xml:lang="hu">Kódkiemelés (korábbi beállítások)</value>
<value xml:lang="it">Colora il codice (scelte precedenti)</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
Expand All @@ -157,6 +164,7 @@
<prop oor:name="Title" oor:type="xs:string">
<value xml:lang="en">Update selection</value>
<value xml:lang="fr">Actualiser la sélection</value>
<value xml:lang="hu">Kijelölés frissítése</value>
<value xml:lang="it">Aggiorna la selezione</value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
Expand Down
1 change: 1 addition & 0 deletions codehighlighter/description.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<src xlink:href="description/desc_en.txt"/>
<src xlink:href="description/desc_en.txt" lang="en" />
<src xlink:href="description/desc_fr.txt" lang="fr" />
<src xlink:href="description/desc_hu.txt" lang="hu" />
<src xlink:href="description/desc_it.txt" lang="it" />
</extension-description>

Expand Down
4 changes: 2 additions & 2 deletions codehighlighter/description/desc_en.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Highlight over 350 languages in Libre Office.
Copy and paste your code, select the text or the containing object and go to Format -> Highlight Code
Highlight over 350 coding languages in LibreOffice Writer, Calc, Impress and Draw.
Copy and paste your code, select the text or the containing object and go to Format Highlight Code
2 changes: 2 additions & 0 deletions codehighlighter/description/desc_hu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Több mint 350 kódolási nyelvének kiemelése a LibreOffice Writer, Calc, Impress és Draw alkalmazásban.
Másolja ki és illessze be a kódot, jelölje ki a szöveget vagy a tartalmazó objektumot, és válassza a Formátum → Kód kiemelése menüpontot
152 changes: 152 additions & 0 deletions locales/hu/LC_MESSAGES/ch2.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-08-26 22:37+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"

#: codehighlighter/python/highlight.py:257
msgid "Please select a paragraph style."
msgstr "Kérjük, válasszon bekezdésstílust."

#: codehighlighter/python/highlight.py:278
#: codehighlighter/python/highlight.py:307
#: codehighlighter/python/highlight.py:322
#: codehighlighter/python/highlight.py:1074
msgid "Unsupported selection."
msgstr "Nem támogatott kijelölés."

#: codehighlighter/python/highlight.py:281
#: codehighlighter/python/highlight.py:300
#: codehighlighter/python/highlight.py:313
#: codehighlighter/python/highlight.py:333
msgid "Nothing to highlight."
msgstr "Nincs mit kiemelni."

#: codehighlighter/python/highlight.py:330
msgid "Update impossible: no formatting attribute associated with this code."
msgstr "Frissítés lehetetlen: ehhez a kódhoz nincs formázási attribútum társítva."

#: codehighlighter/python/highlight.py:434
msgid "Use character ~styles"
msgstr "Karakter~stílusok használata"

#: codehighlighter/python/highlight.py:434
msgid "When possible, code highlighting will be based on character styles."
msgstr "Ha lehetséges, a kódkiemelés karakterstílusokon alapul."

#: codehighlighter/python/highlight.py:435
msgid "Set ~background from style"
msgstr "~Háttér beállítása stílusból"

#: codehighlighter/python/highlight.py:435
msgid "Use the background color provided by the style."
msgstr "Stílus által biztosított háttérszínhasználat."

#: codehighlighter/python/highlight.py:436
msgid "Active or deactivate line numbers."
msgstr "Sorszámok be- vagy kikapcsolása."

#: codehighlighter/python/highlight.py:436
msgid "Add ~line numbering"
msgstr "Sors~zámozás hozzáadása"

#: codehighlighter/python/highlight.py:437
msgid "Separator"
msgstr "Elválasztó"

#: codehighlighter/python/highlight.py:437
#: codehighlighter/python/highlight.py:447
msgid "Use \\t to insert tabulation"
msgstr "\\t használata a táblázat beszúrásához"

#: codehighlighter/python/highlight.py:438
msgid "Padding symbol"
msgstr "Kitöltési szimbólum"

#: codehighlighter/python/highlight.py:438
#: codehighlighter/python/highlight.py:448
msgid "Character to fill the leading space (0 for 01 for example)"
msgstr "Karakter a bevezető mező kitöltésére (0 például 01 esetén)"

#: codehighlighter/python/highlight.py:439
msgid "Parent character style"
msgstr "Szülő karakterstílus"

#: codehighlighter/python/highlight.py:439
#: codehighlighter/python/highlight.py:449
msgid "Use an existing character style as root style."
msgstr "Meglévő karakterstílus használata gyökérstílusként."

#: codehighlighter/python/highlight.py:442
msgid "Height (%)"
msgstr "Magasság (%)"

#: codehighlighter/python/highlight.py:442
msgid "Language"
msgstr "Nyelv"

#: codehighlighter/python/highlight.py:442
msgid "Start at"
msgstr "Kezdés:"

#: codehighlighter/python/highlight.py:442
msgid "Style"
msgstr "Stílus"

#: codehighlighter/python/highlight.py:443
msgid "Highlight all codes formatted with paragraph style:"
msgstr "Jelölje ki az összes bekezdésstílussal formázott kódot:"

#: codehighlighter/python/highlight.py:443
#: codehighlighter/python/highlight.py:1352
msgid "Highlight all"
msgstr "Összes kiemelés"

#: codehighlighter/python/highlight.py:444
msgid "Build upon Pygments {}"
msgstr "Pygments {}-re épült"

#: codehighlighter/python/highlight.py:444
msgid "Preview"
msgstr "Előnézet"

#: codehighlighter/python/highlight.py:450
msgid ""
"Highlight every code snippet in the document that is formatted with the "
"given paragraph style."
msgstr ""
"Jelöljön ki minden olyan kódrészletet a dokumentumban, amely az adott "
"bekezdésstílussal van formázva."

#: codehighlighter/python/highlight.py:485
msgid " (There is currently no style in use.)"
msgstr " (Jelenleg nincs használatban lévő stílus.)"

#: codehighlighter/python/highlight.py:487
msgid " (Writer only.)"
msgstr " (Csak a LibreOffice Writer számára.)"

#: codehighlighter/python/highlight.py:524
msgid "Unsupported language."
msgstr "Nem támogatott nyelv."

#: codehighlighter/python/highlight.py:526
msgid "Unknown style."
msgstr "Ismeretlen stílus."

#: codehighlighter/python/highlight.py:1326
msgid "{} code snippet has been formatted."
msgid_plural "{} code snippets have been formatted."
msgstr[0] "{} kódrészlet formázott."
msgstr[1] "{} kódrészlet formázott."

0 comments on commit 533657a

Please sign in to comment.