Skip to content
Permalink
Browse files
Merge pull request #2772 from stephenc/jenkins-34522
[JENKINS-34522] Expose the noun for a item as a task via AlternativeUiTextProvider
  • Loading branch information
stephenc committed Mar 8, 2017
2 parents 62adfa8 + 3dbf30f commit e0603bb1c1ce17b99ae309db50d697422db82edf
Showing with 29 additions and 863 deletions.
  1. +14 −0 core/src/main/java/hudson/model/AbstractItem.java
  2. +8 −0 core/src/main/java/hudson/views/BuildButtonColumn.java
  3. +1 −0 core/src/main/resources/hudson/model/Messages.properties
  4. +3 −3 core/src/main/resources/hudson/views/BuildButtonColumn/column.jelly
  5. +3 −3 core/src/main/resources/hudson/views/BuildButtonColumn/column.properties
  6. +0 −24 core/src/main/resources/hudson/views/BuildButtonColumn/column_ar.properties
  7. +0 −28 core/src/main/resources/hudson/views/BuildButtonColumn/column_bg.properties
  8. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_ca.properties
  9. +0 −24 core/src/main/resources/hudson/views/BuildButtonColumn/column_cs.properties
  10. +0 −24 core/src/main/resources/hudson/views/BuildButtonColumn/column_da.properties
  11. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_de.properties
  12. +0 −23 core/src/main/resources/hudson/views/BuildButtonColumn/column_el.properties
  13. +0 −23 core/src/main/resources/hudson/views/BuildButtonColumn/column_eo.properties
  14. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_es.properties
  15. +0 −4 core/src/main/resources/hudson/views/BuildButtonColumn/column_es_AR.properties
  16. +0 −4 core/src/main/resources/hudson/views/BuildButtonColumn/column_et.properties
  17. +0 −4 core/src/main/resources/hudson/views/BuildButtonColumn/column_eu.properties
  18. +0 −24 core/src/main/resources/hudson/views/BuildButtonColumn/column_fi.properties
  19. +0 −26 core/src/main/resources/hudson/views/BuildButtonColumn/column_fr.properties
  20. +0 −3 core/src/main/resources/hudson/views/BuildButtonColumn/column_ga_IE.properties
  21. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_he.properties
  22. +0 −3 core/src/main/resources/hudson/views/BuildButtonColumn/column_hi_IN.properties
  23. +0 −24 core/src/main/resources/hudson/views/BuildButtonColumn/column_hu.properties
  24. +0 −4 core/src/main/resources/hudson/views/BuildButtonColumn/column_id.properties
  25. +0 −23 core/src/main/resources/hudson/views/BuildButtonColumn/column_is.properties
  26. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_it.properties
  27. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_ja.properties
  28. +0 −4 core/src/main/resources/hudson/views/BuildButtonColumn/column_kn.properties
  29. +0 −24 core/src/main/resources/hudson/views/BuildButtonColumn/column_ko.properties
  30. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_lt.properties
  31. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_lv.properties
  32. +0 −3 core/src/main/resources/hudson/views/BuildButtonColumn/column_mk.properties
  33. +0 −23 core/src/main/resources/hudson/views/BuildButtonColumn/column_mr.properties
  34. +0 −24 core/src/main/resources/hudson/views/BuildButtonColumn/column_nb_NO.properties
  35. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_nl.properties
  36. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_pl.properties
  37. +0 −27 core/src/main/resources/hudson/views/BuildButtonColumn/column_pt_BR.properties
  38. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_pt_PT.properties
  39. +0 −24 core/src/main/resources/hudson/views/BuildButtonColumn/column_ro.properties
  40. +0 −27 core/src/main/resources/hudson/views/BuildButtonColumn/column_ru.properties
  41. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_sk.properties
  42. +0 −3 core/src/main/resources/hudson/views/BuildButtonColumn/column_sl.properties
  43. +0 −5 core/src/main/resources/hudson/views/BuildButtonColumn/column_sr.properties
  44. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_sv_SE.properties
  45. +0 −4 core/src/main/resources/hudson/views/BuildButtonColumn/column_te.properties
  46. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_tr.properties
  47. +0 −24 core/src/main/resources/hudson/views/BuildButtonColumn/column_uk.properties
  48. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_zh_CN.properties
  49. +0 −25 core/src/main/resources/hudson/views/BuildButtonColumn/column_zh_TW.properties
@@ -133,6 +133,15 @@ public String getPronoun() {
return AlternativeUiTextProvider.get(PRONOUN, this, Messages.AbstractItem_Pronoun());
}

/**
* Gets the term used in the UI to represent the kind of {@link Queue.Task} associated with this kind of
* {@link Item}. Must start with a capital letter. Defaults to "Build".
* @since FIXME
*/
public String getTaskNoun() {
return AlternativeUiTextProvider.get(TASK_NOUN, this, Messages.AbstractItem_TaskNoun());
}

@Exported
/**
* @return The display name of this object, or if it is not set, the name
@@ -749,4 +758,9 @@ public static AbstractItem resolveForCLI(
*/
public static final Message<AbstractItem> PRONOUN = new Message<AbstractItem>();

/**
* Replaceable noun for describing the kind of task that this item represents. Defaults to "Build".
*/
public static final Message<AbstractItem> TASK_NOUN = new Message<>();

}
@@ -24,6 +24,7 @@
package hudson.views;

import hudson.Extension;
import hudson.model.AbstractItem;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;

@@ -32,6 +33,13 @@ public class BuildButtonColumn extends ListViewColumn {
public BuildButtonColumn() {
}

public String taskNoun(Object job) {
if (job instanceof AbstractItem) {
return ((AbstractItem) job).getTaskNoun();
}
return hudson.model.Messages.AbstractItem_TaskNoun();
}

@Extension(ordinal=DEFAULT_COLUMNS_ORDINAL_ACTIONS_START-1) @Symbol("buildButton")
public static class DescriptorImpl extends ListViewColumnDescriptor {
@Override
@@ -31,6 +31,7 @@ AbstractBuild.KeptBecause=This build is kept because of {0}.
AbstractItem.NoSuchJobExists=No such job \u2018{0}\u2019 exists. Perhaps you meant \u2018{1}\u2019?
AbstractItem.NoSuchJobExistsWithoutSuggestion=No such job \u2018{0}\u2019 exists.
AbstractItem.Pronoun=Item
AbstractItem.TaskNoun=Build
AbstractProject.AssignedLabelString_NoMatch_DidYouMean=There\u2019s no agent/cloud that matches this assignment. Did you mean \u2018{1}\u2019 instead of \u2018{0}\u2019?
AbstractProject.NewBuildForWorkspace=Scheduling a new build to get a workspace.
AbstractProject.AwaitingBuildForWorkspace=Awaiting build to get a workspace.
@@ -30,11 +30,11 @@ THE SOFTWARE.
<a href="${jobBaseUrl}${job.shortUrl}build?delay=0sec">
<j:choose>
<j:when test="${job.parameterized}">
<j:set var="title" value="${%Schedule_a_build_with_parameters(h.getRelativeDisplayNameFrom(job, itemGroup))}"/>
<j:set var="title" value="${%Schedule_a_task_with_parameters(h.getRelativeDisplayNameFrom(job, itemGroup),it.taskNoun(job))}"/>
<j:set var="onclick" value="${null}"/>
</j:when>
<j:otherwise>
<j:set var="title" value="${%Schedule_a_build(h.getRelativeDisplayNameFrom(job, itemGroup))}"/>
<j:set var="title" value="${%Schedule_a_task(h.getRelativeDisplayNameFrom(job, itemGroup),it.taskNoun(job))}"/>
<j:set var="onclick" value="return build_${id}(this)"/>
</j:otherwise>
</j:choose>
@@ -46,7 +46,7 @@ THE SOFTWARE.
<script>
function build_${id}(img) {
new Ajax.Request(img.parentNode.href);
hoverNotification('${%Build_scheduled}', img, -100);
hoverNotification('${%Task_scheduled(it.taskNoun(job))}', img, -100);
return false;
}
</script>
@@ -20,6 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

Build_scheduled=Build scheduled
Schedule_a_build=Schedule a build for {0}
Schedule_a_build_with_parameters=Schedule a build with parameters for {0}
Task_scheduled={0} scheduled
Schedule_a_task=Schedule a {1} for {0}
Schedule_a_task_with_parameters=Schedule a {1} with parameters for {0}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit e0603bb

Please sign in to comment.