[libcalamares] Document recommended translation contexts

Jobs have specific contexts for their different strings.
Many jobs (now) misuse prettyName() as a status message,
although the existing fallback mechanism means that the
name gets used as if it is a status message when the job
does not define a description or status.
This commit is contained in:
Adriaan de Groot 2024-04-13 23:30:57 +02:00
parent 219befacbf
commit fb83ad326b

View File

@ -109,12 +109,23 @@ public:
* which of the jobs is "heavy" and which is not. * which of the jobs is "heavy" and which is not.
*/ */
virtual int getJobWeight() const; virtual int getJobWeight() const;
/** @brief The human-readable name of this job /** @brief The human-readable name of this job
* *
* This should be a very short statement of what the job does. * This should be a very short statement of what the job does.
* For status and state information, see prettyStatusMessage(). * For status and state information, see prettyStatusMessage().
*
* The job's name may be similar to the status message, but this is
* a name, and should not be an active verb phrase. The translation
* should use context @c @label .
*
* The name of the job is used as a **fallback** when the status
* or descriptions are empty. If a job has no implementation of
* those methods, it is OK to use other contexts, but it may look
* strange in some places in the UI.
*/ */
virtual QString prettyName() const = 0; virtual QString prettyName() const = 0;
/** @brief a longer human-readable description of what the job will do /** @brief a longer human-readable description of what the job will do
* *
* This **may** be used by view steps to fill in the summary * This **may** be used by view steps to fill in the summary
@ -122,15 +133,23 @@ public:
* module does so. * module does so.
* *
* The default implementation returns an empty string. * The default implementation returns an empty string.
*
* The translation should use context @c @title .
*/ */
virtual QString prettyDescription() const; virtual QString prettyDescription() const;
/** @brief A human-readable status for progress reporting /** @brief A human-readable status for progress reporting
* *
* This is called from the JobQueue when progress is made, and should * This is called from the JobQueue when progress is made, and should
* return a not-too-long description of the job's status. This * return a not-too-long description of the job's status. This
* is made visible in the progress bar of the execution view step. * is made visible in the progress bar of the execution view step.
*
* The job's status should say **what** the job is doing. It should be in
* present active tense. Typically the translation uses tr() context
* @c @status . See prettyName() for examples.
*/ */
virtual QString prettyStatusMessage() const; virtual QString prettyStatusMessage() const;
virtual JobResult exec() = 0; virtual JobResult exec() = 0;
bool isEmergency() const { return m_emergency; } bool isEmergency() const { return m_emergency; }