האם להגדיר את שם הפלאגין להכתבות?

זוהי כנראה שאלה טיפשה, אבל הא OCD הקטן שלי מתעורר.
יצרתי תוסף אך רק המילה הראשונה בשם היא עם אות גדולה.
בדקתי כמה קבצי plugin.rb אחרים ולא ראיתי שם מילים עם אותיות רישיות וגם ל- /config/settings.yml אין אותיות רישיות.
האם יש קובץ אחר שאני צריך ליצור כדי להשיג את מה שאני רוצה?

אתה כנראה יכול לעשות זאת עם CSS.
אתה יכול למקד את אלמנט שם ההתקן ולהשתמש ב-text-transform: capitalize. זה יגרום למלים להיות באותיות גדולות.

rame על נייד עכשיו ולכן לא יכול לבדוק את האלמנט

לייק 1

זה היה מתקן את זה באתר שלי, אבל אם תתקין את התוסף שלי, זה עדיין יהיה שבור באתר שלך.
אני מחפש פתרון להתאים את התוסף עצמו, אני לא חושב שתוספים אחרים משתמשים ב-CSS כדי להשיג את זה.

הממ… יש לי מושג למה זה קורה, אבל כדי להיות בטוח, אפשר לדעת איזה תוסף יש לו את הבעיה הזאת?

בנית תוסף מותאם אישית. אני רוצה לשתף אותו עם הקהילה בסופו של דבר, אבל הייתי רוצה לתקן לפחות את הדבר הזה שגורם לי להיראות כמו פורסט ויטקר עיניים לפני שאעשה זאת.

לייק 1

האם אפשר לשלוח את קובץ ה-yml שלך להגדרות, או את קובץ האזור?
תודה.

אני פשוט שלחתי את זה בהודעה פרטית.

לייק 1

Well, if I install your plugin and every word is captilized, from my, and majority of the world, point of view your plugin is broken that way.

You can’t win. You have to choose if you want to do how you want or how most of the globe works :man_shrugging:

Not a major question, though.

לייק 1

This is a hint :wink:
Discourse plugin names and settings are lowercase as a convention.

2 לייקים

I wasn’t sure what the current convention was for the name displayed on the /plugins page. There seems to be a mix of sentence and title case for different ones (eg Data explorer v Documentation Categories)

לייק 1

If this is about the display name, this is how it works.

If your plugin has metadata # name: discourse-foo-bar in plugin.rb,

Then the plugin will be shown as “Foo bar”

But you can override this in locales/client.XX.yml

en:
  admin_js:
    admin:
      site_settings:
        categories:
          discourse_foo_bar: "Discourse Foo Bar Blah"

The plugins will be sorted by what comes after discourse- though.

לייק 1

What about the

?

  • admin_js.admin.site_settings.categories.discourse_foo_plugin
    – שם ברשימת /admin/plugins

  • js.discourse_foo_plugin.title
    – כותרת במסך הניהול של התוסף (/admin/plugins/discourse-foo-plugin)

  • js.discourse_foo_plugin.admin_navigation
    – שֵׁם בתפריט הצד של הניהול

4 לייקים

הבנתי, תודה שהבהרת!

Yes, display name.
I have this in a config/locales/client.en.yml file, I rebuilt, and there was no change.

en:
  admin_js:
    admin:
      site_settings:
        categories:
          auto_remove_group: "Auto Remove User from Group"
  site_settings:
    auto_remove_group_enabled: Enable the Auto Remove User from Group plugin.
    auto_remove_group_category_id: Set the category ID number you are watching for posts. It can be found in the URL when you navigate to a category.
    auto_remove_group_name: Set the group you want the user to be removed from once they post in category selected above.

Actually, the general consensus is that each word in a title is capitalized.

ועדיין זה לא כך. זו דרך אמריקאית, מגיע מהחדשות.

לייק 1

טוב, מתוך 10 התוספים שהתקנתי שבנטועים יותר ממש слово אחד, 7 מהם בהכתב באות גדולה.
and הרבה יותר בחלק התוספים של אתר זה מקפידים על ההנחיה הזו. וזה מה שאני רוצה שגם התוספים שלי ייראו כך.

המפתח שלך הוא auto_remove_group אך ה-#name שלך ב-plugin.rb הוא discourse-auto-remove-group.

נסה להוסיף את הקידומת discourse_ למפתח

לייק 1

I made the change, but there was no love.
Is it correct that the #name is using dashes, but the key is using underscores?