Answers.Body: <p>In Craft 2, the Craft default Yii translation method was overridden to only require one value, the value of the translatable string:</p>
  
  <pre><code>Craft::t('My Translatable String');
  </code></pre>
  
  <p>In Craft 3, Craft reverts to using the <a href="http://www.yiiframework.com/doc-2.0/yii-baseyii.html#t()-detail" rel="noreferrer">default Yii behavior</a> for the Translate method <code>t()</code> and there are two arguments needed.  The first argument is now the <code>category</code> and the second is the translatable string:</p>
  
  <pre><code>Craft::t('pluginhandle', 'My Translatable String');
  </code></pre>
  
  <p>Adding the category back allows translations from different contexts to avoid conflicts with each other.</p>
  
  <p>Craft uses the <code>app</code> category.  Yii uses the <code>yii</code> category.  And plugins should use their own plugin handles.</p>
  
  <p>The front-end of a site should use <code>site</code> category, and the actual translation files should be saved in <code>translations/locale/category.php</code> (whether that's in <code>craft/</code> or <code>craft/plugins/mypluginname/</code>)</p>
  
  <p><em>(Hat tip to Brandon Kelly for helping me understand this better on Craft Slack)</em></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-19T02:07:44.353Z
Answers.LastActivityDate: 2015-08-19T02:21:21.877Z
Answers.LastEditDate: 2015-08-19T02:21:21.877Z
Answers.UserDisplayName: Ben Parizek
Body: <p>I'm trying to update my plugin to Craft 3 and I'm getting this error message:</p>
  
  <pre><code>Unable to locate message source for category ''.
  </code></pre>
  
  <p>What does it mean?!</p>
  
Tags: <localization><craft3>
Title: Unable to locate message source for category ''
ThreadText: # Unable to locate message source for category ''
  
  (Asked by: username_0 on 2015-08-19)
  
  I'm trying to update my plugin to Craft 3 and I'm getting this error message:
  
  ```
  Unable to locate message source for category ''.
  
  ```
  
  What does it mean?!
  
  **Tags:** localization, craft3
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-08-19. Score: 5
  
  In Craft 2, the Craft default Yii translation method was overridden to only require one value, the value of the translatable string:
  
  ```
  Craft::t('My Translatable String');
  
  ```
  
  In Craft 3, Craft reverts to using the [default Yii behavior](http://www.yiiframework.com/doc-2.0/yii-baseyii.html#t()-detail) for the Translate method `t()` and there are two arguments needed. The first argument is now the `category` and the second is the translatable string:
  
  ```
  Craft::t('pluginhandle', 'My Translatable String');
  
  ```
  
  Adding the category back allows translations from different contexts to avoid conflicts with each other.
  
  Craft uses the `app` category. Yii uses the `yii` category. And plugins should use their own plugin handles.
  
  The front-end of a site should use `site` category, and the actual translation files should be saved in `translations/locale/category.php` (whether that's in `craft/` or `craft/plugins/mypluginname/`)
  
  *(Hat tip to Brandon Kelly for helping me understand this better on Craft Slack)*
  
  
  ---
  
  