mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 04:04:59 -05:00
DEV: add create-topic-label value transformer (#32621)
On mobile we remove the create topic button label:  and we don't have a great way to add it back (https://meta.discourse.org/t/new-topic-button-hidden-text/364902) this will allow the translation to be set for both mobile and desktop like this: ```js import { apiInitializer } from "discourse/lib/api"; export default apiInitializer((api) => { api.registerValueTransformer("create-topic-label", ({ value, context }) => { return context.defaultKey; }); }); ```  and also grants the flexibility to have a custom labels for mobile and desktop
This commit is contained in:
@@ -35,7 +35,13 @@ export default class DNavigation extends Component {
|
||||
@setting("fixed_category_positions") fixedCategoryPositions;
|
||||
|
||||
get createTopicLabel() {
|
||||
return this.site.desktopView ? "topic.create" : "";
|
||||
const defaultKey = "topic.create";
|
||||
|
||||
return applyValueTransformer(
|
||||
"create-topic-label",
|
||||
this.site.desktopView ? defaultKey : "",
|
||||
{ site: this.site, defaultKey }
|
||||
);
|
||||
}
|
||||
|
||||
get showBulkSelectInNavControls() {
|
||||
|
||||
@@ -18,6 +18,7 @@ export const VALUE_TRANSFORMERS = Object.freeze([
|
||||
"category-text-color",
|
||||
"composer-save-button-label",
|
||||
"composer-service-cannot-submit-post",
|
||||
"create-topic-label",
|
||||
"flag-description",
|
||||
"flag-custom-placeholder",
|
||||
"flag-formatted-name",
|
||||
|
||||
Reference in New Issue
Block a user