2023-03-01 14:06:34 +01:00
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2023, The Funkwhale Collective
# This file is distributed under the same license as the funkwhale package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
2023-03-24 18:14:43 +01:00
"Project-Id-Version: funkwhale 1.2.10\n"
2023-03-01 14:06:34 +01:00
"Report-Msgid-Bugs-To: \n"
2023-03-24 18:14:43 +01:00
"POT-Creation-Date: 2023-03-24 18:14+0100\n"
2023-03-01 14:06:34 +01:00
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:1
2023-03-01 14:06:34 +01:00
msgid "Write a plugin"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:3
2023-03-01 14:06:34 +01:00
msgid "You can write plugins to extend the features of your Funkwhale pod. Follow the instructions in this guide to get started with your first plugin."
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:10
2023-03-01 14:06:34 +01:00
msgid "Before you begin"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:12
2023-03-01 14:06:34 +01:00
msgid "Before you start writing your plugin, you need to understand the following core concepts:"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:19
2023-03-01 14:06:34 +01:00
msgid "We'll explain each of these concepts in the next few sections"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:21
2023-03-01 14:06:34 +01:00
msgid "Scopes"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:23
2023-03-01 14:06:34 +01:00
msgid "Plugins fall into two different **scopes**:"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:25
2023-03-01 14:06:34 +01:00
msgid "User-level plugins that are configured by end-users for their own use"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:26
2023-03-01 14:06:34 +01:00
msgid "Pod-level plugins that are configured by pod admins and are not connected to a particular user"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:28
2023-03-01 14:06:34 +01:00
msgid "User-level plugins can also be used to import files from a third-party service, such as cloud storage or FTP."
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:30
2023-03-01 14:06:34 +01:00
msgid "Hooks"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:32
2023-03-01 14:06:34 +01:00
msgid "**Hooks** are entrypoints that allow your plugin to listen to changes. You can create hooks to react to different events that occur in the Funkwhale application."
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:34
2023-03-01 14:06:34 +01:00
msgid "An example of this can be seen in our Scrobbler plugin. We register a `LISTENING_CREATED` hook to notify any registered callback function when a listening is recorded. When a user listens to a track, the `notfy_lastfm` function fires."
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:45
2023-03-01 14:06:34 +01:00
msgid "Available hooks"
msgstr ""
#: ../../docstring of config.plugins.LISTENING_CREATED:1
msgid "Called when a track is being listened"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:51
2023-03-01 14:06:34 +01:00
msgid "Filters"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:53
2023-03-01 14:06:34 +01:00
msgid "**Filters** are entrypoints that allow you to modify or add information. When you use the `register_filter` decorator, your function should return a value to be used by the server."
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:55
2023-03-01 14:06:34 +01:00
msgid "In this example, the `PLUGINS_DEPENDENCIES` filter is used to install additional dependencies required by your plugin. The `dependencies` function returns the additional dependency `django_prometheus` to request the dependency be installed by the server."
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:68
2023-03-01 14:06:34 +01:00
msgid "Available filters"
msgstr ""
#: ../../docstring of config.plugins.PLUGINS_DEPENDENCIES:1
msgid "Called with an empty list, use this filter to append pip dependencies to the list for installation."
msgstr ""
#: ../../docstring of config.plugins.PLUGINS_APPS:1
msgid "Called with an empty list, use this filter to append apps to INSTALLED_APPS"
msgstr ""
#: ../../docstring of config.plugins.MIDDLEWARES_BEFORE:1
msgid "Called with an empty list, use this filter to prepend middlewares to MIDDLEWARE"
msgstr ""
#: ../../docstring of config.plugins.MIDDLEWARES_AFTER:1
msgid "Called with an empty list, use this filter to append middlewares to MIDDLEWARE"
msgstr ""
#: ../../docstring of config.plugins.URLS:1
msgid "Called with an empty list, use this filter to register new urls and views"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:78
2023-03-01 14:06:34 +01:00
msgid "Write your plugin"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:80
2023-03-01 14:06:34 +01:00
msgid "Once you know what type of plugin you want to write and what entrypoint you want to use, you can start writing your plugin."
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:82
2023-03-01 14:06:34 +01:00
msgid "Plugins are made up of the following 3 files:"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:84
2023-03-01 14:06:34 +01:00
msgid "`__init__.py` - indicates that the directory is a Python package"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:85
2023-03-01 14:06:34 +01:00
msgid "`funkwhale_startup.py` - the file that loads during Funkwhale initialization"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:86
2023-03-01 14:06:34 +01:00
msgid "`funkwhale_ready.py` - the file that loads when Funkwhale is configured and ready"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:88
2023-03-01 14:06:34 +01:00
msgid "Declare your plugin"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:90
2023-03-01 14:06:34 +01:00
msgid "You need to declare your plugin and its configuration options so that Funkwhale knows how to load the plugin. To do this, you must declare a new `plugins` instance in your `funkwhale_startup.py` file."
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:92
2023-03-01 14:06:34 +01:00
msgid "Your `plugins` should include the following information:"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:98
2023-03-01 14:06:34 +01:00
msgid "Parameter"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:99
2023-03-01 14:06:34 +01:00
msgid "Data type"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:100
2023-03-01 14:06:34 +01:00
msgid "Description"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:101
2023-03-01 14:06:34 +01:00
msgid "`name`"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:102
#: ../../developer/plugins/create.md:105
#: ../../developer/plugins/create.md:108
#: ../../developer/plugins/create.md:111
2023-03-01 14:06:34 +01:00
msgid "String"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:103
2023-03-01 14:06:34 +01:00
msgid "The name of your plugin, used in the `.env` file"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:104
2023-03-01 14:06:34 +01:00
msgid "`label`"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:106
2023-03-01 14:06:34 +01:00
msgid "The readable label that appears in the Funkwhale frontend"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:107
2023-03-01 14:06:34 +01:00
msgid "`description`"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:109
2023-03-01 14:06:34 +01:00
msgid "A meaningful description of your plugin and what it does"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:110
2023-03-01 14:06:34 +01:00
msgid "`version`"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:112
2023-03-01 14:06:34 +01:00
msgid "The version number of your plugin"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:113
2023-03-01 14:06:34 +01:00
msgid "`user`"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:114
2023-03-01 14:06:34 +01:00
msgid "Boolean"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:115
2023-03-01 14:06:34 +01:00
msgid "Whether the plugin is a **user-level** plugin or a **pod-level** plugin. See [scopes](#scopes) for more information"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:116
2023-03-01 14:06:34 +01:00
msgid "`conf`"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:117
2023-03-01 14:06:34 +01:00
msgid "Array of Objects"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:118
2023-03-01 14:06:34 +01:00
msgid "A list of configuration options"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:121
2023-03-01 14:06:34 +01:00
msgid "In this example, we declare a new **user-level** plugin called \"My Plugin\". The user can configure a `greeting` in the plugin configuration."
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:140
2023-03-01 14:06:34 +01:00
msgid "Write your plugin logic"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:142
2023-03-01 14:06:34 +01:00
msgid "Once you've declared your plugin, you can write the plugin code in your `funkwhale_ready.py` file."
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:145
2023-03-01 14:06:34 +01:00
msgid "You must import your plugin declaration from your `funkwhale_startup.py` file."
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:148
2023-03-01 14:06:34 +01:00
msgid "In this example, we create a simple API endpoint that returns a greeting to the user. To do this:"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:150
2023-03-01 14:06:34 +01:00
msgid "We create a new APIView class that accepts a `GET` request"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:151
2023-03-01 14:06:34 +01:00
msgid "We read the greeting value from the plugin `conf`"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:152
2023-03-01 14:06:34 +01:00
msgid "We return the greeting value with the user's username"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:153
2023-03-01 14:06:34 +01:00
msgid "We register this view at the endpoint `/greeting`"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:193
2023-03-01 14:06:34 +01:00
msgid "Result"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:195
2023-03-01 14:06:34 +01:00
msgid "Here is an example of how the above plugin works:"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:197
2023-03-01 14:06:34 +01:00
msgid "User \"Harry\" enables the plugin"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:198
2023-03-01 14:06:34 +01:00
msgid "\"Harry\" changes the greeting to \"You're a wizard\""
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:199
2023-03-01 14:06:34 +01:00
msgid "\"Harry\" visits the `/greeting` endpoint in their browser"
msgstr ""
2023-03-01 14:40:19 +01:00
#: ../../developer/plugins/create.md:200
2023-03-01 14:06:34 +01:00
msgid "The browser returns the message \"You're a wizard Harry\""
msgstr ""