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

お気に入りタグ機能のロケール対応 #37

Merged
merged 2 commits into from
Aug 15, 2017

Conversation

takayamaki
Copy link
Member

とりあえずja.ymlとen.ymlだけ(ja-IMは逆輸出のために別commitにするつもり

  • react-intlの繋ぎ込みがほかのところを参考にしたつもりなのにうまく動いていない
  • お気に入りタグ設定画面の追加ボタンのロケール対応方法がわからない
    • けどなぜかlocaleに合わせて変化している

わからんこ(画像略

@lnanase
Copy link
Collaborator

lnanase commented Aug 10, 2017

Reactでのlocaleはymlファイルではなくjsのjsonファイルをいじる必要があります。

@takayamaki
Copy link
Member Author

reactのロケールはjsでしたねそうでしたね…

@lnanase
Copy link
Collaborator

lnanase commented Aug 10, 2017

( ・∀・)つpatchドゾー

diff --git a/app/javascript/mastodon/features/compose/components/favourite_tags.js b/app/javascript/mastodon/features/compose/components/favourite_tags.js
index 4903cdd2..b220f31e 100644
--- a/app/javascript/mastodon/features/compose/components/favourite_tags.js
+++ b/app/javascript/mastodon/features/compose/components/favourite_tags.js
@@ -36,6 +36,8 @@ class FavouriteTags extends React.PureComponent {
   }
 
   render () {
+    const { intl } = this.props;
+
     const tags = this.props.tags.map(tag => (
       <li key={tag.get('name')}>
         <Link
@@ -58,7 +60,7 @@ class FavouriteTags extends React.PureComponent {
       <div className='favourite-tags'>
         <div className='favourite-tags__header'>
           <i className='fa fa-tag' />
-          <div className='favourite-tags__header__name'>{formatMessage(messages.favourite_tags)}</div>
+          <div className='favourite-tags__header__name'>{intl.formatMessage(messages.favourite_tags)}</div>
           <div className='favourite-tags__lock'>
             <a href='/settings/favourite_tags'>
               <i className='fa fa-gear' />
diff --git a/app/javascript/mastodon/locales/defaultMessages.json b/app/javascript/mastodon/locales/defaultMessages.json
index b75aab19..1cbe5eb8 100644
--- a/app/javascript/mastodon/locales/defaultMessages.json
+++ b/app/javascript/mastodon/locales/defaultMessages.json
@@ -551,6 +551,15 @@
   {
     "descriptors": [
       {
+        "defaultMessage": "Favourite tags",
+        "id": "settings.favourite_tags"
+      }
+    ],
+    "path": "app/javascript/mastodon/features/compose/components/favourite_tags.json"
+  },
+  {
+    "descriptors": [
+      {
         "defaultMessage": "Edit profile",
         "id": "navigation_bar.edit_profile"
       }
diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json
index fae2016c..31965cc6 100644
--- a/app/javascript/mastodon/locales/en.json
+++ b/app/javascript/mastodon/locales/en.json
@@ -159,6 +159,7 @@
   "report.target": "Reporting {target}",
   "search.placeholder": "Search",
   "search_results.total": "{count, number} {count, plural, one {result} other {results}}",
+  "settings.favourite_tags": "Favourite tags",
   "standalone.public_title": "A look inside...",
   "status.cannot_reblog": "This post cannot be boosted",
   "status.delete": "Delete",
diff --git a/app/javascript/mastodon/locales/ja.json b/app/javascript/mastodon/locales/ja.json
index da3b55f8..8a09aea0 100644
--- a/app/javascript/mastodon/locales/ja.json
+++ b/app/javascript/mastodon/locales/ja.json
@@ -159,6 +159,7 @@
   "report.target": "{target} を通報する",
   "search.placeholder": "検索",
   "search_results.total": "{count, number}件の結果",
+  "settings.favourite_tags": "お気に入りタグ",
   "standalone.public_title": "連合タイムライン",
   "status.cannot_reblog": "この投稿はブーストできません",
   "status.delete": "削除",

@takayamaki takayamaki force-pushed the favourite-tags-locale branch 2 times, most recently from d952422 to 3a77bc3 Compare August 11, 2017 16:54
@lnanase
Copy link
Collaborator

lnanase commented Aug 15, 2017

LGTM

@takayamaki takayamaki merged commit 6ef39ab into imas:imastodon Aug 15, 2017
@takayamaki takayamaki deleted the favourite-tags-locale branch August 15, 2017 02:08
@takayamaki takayamaki changed the title [WIP] お気に入りタグ機能のロケール対応 お気に入りタグ機能のロケール対応 Aug 15, 2017
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

Successfully merging this pull request may close these issues.

2 participants