Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capitalize each word of moon phase #151

Open
cataseven opened this issue Oct 26, 2024 · 1 comment
Open

Capitalize each word of moon phase #151

cataseven opened this issue Oct 26, 2024 · 1 comment

Comments

@cataseven
Copy link

cataseven commented Oct 26, 2024

Hi @ThomDietrich

I am not a developer just and learning and coding as hobby. So maybe there is an easier way to do it and also I have no idea about pull requests :)

In order to make Uppercase each words of Moon Phases, can you please add following change to line 2832 and 2833

moon_phase_localized = moon_phase_localized.split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');

    key: "renderMoonElement",
    value: function renderMoonElement(i18n, phase, phaseRotation) {
      if (phase === undefined) {
        return A;
      }
      var moon_phase_localized = i18n.localize("component.moon.entity.sensor.phase.state.".concat(phase.state));
      if (!moon_phase_localized) {
        moon_phase_localized = x(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteral(["<span title=\"Install Moon integration to get localized Moon phase name\">", " (!)</span>"])), phase.state);
      }
      **// Split the localized moon phase name into words, capitalize the first letter of each word, and join them back together
      moon_phase_localized = moon_phase_localized.split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');**
      return x(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteral(["\n      <div class=\"horizon-card-text-container\">\n        <div class=\"horizon-card-field-moon-phase\" style=\"transform: rotate(", "deg)\">\n          <ha-icon icon=\"mdi:", "\"></ha-icon>\n        </div>\n        <div class=\"horizon-card-field-value horizon-card-field-value-moon-phase\">", "</div>\n      </div>\n    "])), phaseRotation, phase.icon, moon_phase_localized);
    }
@scinos
Copy link
Collaborator

scinos commented Nov 7, 2024

What's the goal of uppercasing each word?

For the record, translations from the moon phases come from Home Assistant itself. English names are in https://github.com/home-assistant/core/blob/dev/homeassistant/components/moon/strings.json, and other languages are managed via Lokalise (https://developers.home-assistant.io/docs/translations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants