Answers.Body: <p>Looks like you're using the <a href="https://plugins.craftcms.com/store-hours" rel="nofollow noreferrer">Store Hours plugin</a>, right? If you check the <a href="https://github.com/craftcms/store-hours/blob/main/src/data/DayData.php#L50-L59" rel="nofollow noreferrer">source code</a>, you can see that the <code>name</code> property is already returned as a localized day name by default:</p>
  <pre class="lang-php prettyprint-override"><code>return Craft::$app-&gt;getLocale()-&gt;getWeekDayName($this-&gt;dayIndex, $length);
  </code></pre>
  <p>So you probably don't need to do anything, the weekday name will be translated to the current site's language automatically.</p>
  <p>If this doesn't work for you or you need to translate the day name to a different language for some reason, you can access the <a href="https://github.com/craftcms/store-hours/blob/main/src/data/DayData.php#L18-L21" rel="nofollow noreferrer">public <code>dayIndex</code> property</a> of the <code>DayData</code> object directly. This will be an integer between 0-6, you can use that to use <code>getWeekDayName</code> function with the locale you want to translate to. Or use built-in functions:</p>
  <pre class="lang-twig prettyprint-override"><code>{{ day.dateIndex|date('l') }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-02T12:34:34.553Z
Answers.LastActivityDate: 2022-08-02T12:34:34.553Z
Answers.UserDisplayName: MoritzLost
Body: <p>Maybe I'm overlooking something here, but I can't find a way to translate the week day names.</p>
  <p>This is my template code:</p>
  <pre><code>{% set storeHours = storeHoursGlob.storeHours.getRange(1) %}
  
  &lt;div class=&quot;p-8 xl:container mx-auto&quot;&gt;
      &lt;h3&gt;Openingstijden&lt;/h3&gt;
      &lt;div class=&quot;grid grid-cols-7&quot;&gt;
      {% for day in storeHours %}
          &lt;div class=&quot;flex flex-col bg-white&quot;&gt;
              &lt;h2 class=&quot;text-[#339F7F]&quot;&gt;{{ day.name }}&lt;/h2&gt;
              &lt;dd&gt;
              {% if day.isBlank %}
                  Gesloten
              {% else %}
                  {{ day.open|date('H:i') }} - {{ day.close|date('H:i') }}
              {% endif %}
              &lt;/dd&gt;
          &lt;/div&gt;
      {% endfor %}
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>Anyone who can point me in the right direction?
  Thank you very much in advance!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-02T11:43:10.360Z
Comments.Text: What exactly is `storeHoursGlob`?
Comments.UserDisplayName: Ben Croker
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-02T13:35:19.703Z
Comments.Text: Maybe Glob = global?
Comments.UserDisplayName: RitterKnight
Tags: <craft3><localization>
Title: Way to translate days in CraftCMS 'Opening Hours'
ThreadText: # Way to translate days in CraftCMS 'Opening Hours'
  
  (Asked by: username_0 on 2022-08-02)
  
  Maybe I'm overlooking something here, but I can't find a way to translate the week day names.
  
  This is my template code:
  
  ```
  {% set storeHours = storeHoursGlob.storeHours.getRange(1) %}
  
  <div class="p-8 xl:container mx-auto">
      <h3>Openingstijden</h3>
      <div class="grid grid-cols-7">
      {% for day in storeHours %}
          <div class="flex flex-col bg-white">
              <h2 class="text-[#339F7F]">{{ day.name }}</h2>
              <dd>
              {% if day.isBlank %}
                  Gesloten
              {% else %}
                  {{ day.open|date('H:i') }} - {{ day.close|date('H:i') }}
              {% endif %}
              </dd>
          </div>
      {% endfor %}
      </div>
  </div>
  
  ```
  
  Anyone who can point me in the right direction?
  Thank you very much in advance!
  
  **Tags:** craft3, localization
  
  > **Comments:**
  > **username_1**: What exactly is `storeHoursGlob`?  
  > **username_2**: Maybe Glob = global?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2022-08-02. Score: 2
  
  Looks like you're using the [Store Hours plugin](https://plugins.craftcms.com/store-hours), right? If you check the [source code](https://github.com/craftcms/store-hours/blob/main/src/data/DayData.php#L50-L59), you can see that the `name` property is already returned as a localized day name by default:
  
  ```php
  return Craft::$app->getLocale()->getWeekDayName($this->dayIndex, $length);
  
  ```
  
  So you probably don't need to do anything, the weekday name will be translated to the current site's language automatically.
  
  If this doesn't work for you or you need to translate the day name to a different language for some reason, you can access the [public `dayIndex` property](https://github.com/craftcms/store-hours/blob/main/src/data/DayData.php#L18-L21) of the `DayData` object directly. This will be an integer between 0-6, you can use that to use `getWeekDayName` function with the locale you want to translate to. Or use built-in functions:
  
  ```twig
  {{ day.dateIndex|date('l') }}
  
  ```
  
  
  ---
  
  