diff --git a/Resource/locale/messages.en.yaml b/Resource/locale/messages.en.yaml index ea95947..c810d7f 100644 --- a/Resource/locale/messages.en.yaml +++ b/Resource/locale/messages.en.yaml @@ -27,6 +27,12 @@ api: 'scope.mcp:order:read.description': 'Read %shop_name% order data' 'scope.mcp:customer:read.description': 'Read %shop_name% customer data' 'scope.mcp:plugin:read.description': 'Read %shop_name% plugin information' + 'scope.acp:checkout.description': 'Check out at %shop_name% (create, update and complete orders)' + 'scope.acp:catalog.description': 'Read %shop_name% catalog data' + 'scope.ucp:checkout.description': 'Check out at %shop_name% (create, update and complete orders)' + 'scope.ucp:cart.description': 'Operate your %shop_name% cart (add, change and remove items)' + 'scope.ucp:catalog.description': 'Read %shop_name% catalog data' + 'scope.ucp:identity.description': 'Link your %shop_name% member ID (identify you as a member)' redirect_uri: Redirect URI redirect_uri_tooltip: You can enter multiple URIs separated by commas grant_type: Grant Type diff --git a/Resource/locale/messages.ja.yaml b/Resource/locale/messages.ja.yaml index 32dac2f..4fdfee3 100644 --- a/Resource/locale/messages.ja.yaml +++ b/Resource/locale/messages.ja.yaml @@ -27,6 +27,12 @@ api: 'scope.mcp:order:read.description': '%shop_name%の注文データの読み取り' 'scope.mcp:customer:read.description': '%shop_name%の顧客会員データの読み取り' 'scope.mcp:plugin:read.description': '%shop_name%のプラグイン情報の読み取り' + 'scope.acp:checkout.description': '%shop_name%でのチェックアウト(注文の作成・更新・確定)' + 'scope.acp:catalog.description': '%shop_name%のカタログデータの読み取り' + 'scope.ucp:checkout.description': '%shop_name%でのチェックアウト(注文の作成・更新・確定)' + 'scope.ucp:cart.description': '%shop_name%のカートの操作(商品の追加・変更・削除)' + 'scope.ucp:catalog.description': '%shop_name%のカタログデータの読み取り' + 'scope.ucp:identity.description': '%shop_name%の会員IDとの連携(会員としての本人確認)' redirect_uri: リダイレクトURI redirect_uri_tooltip: カンマ区切りで複数のURIを入力可能 grant_type: グラントタイプ diff --git a/Tests/Resource/ScopeTranslationTest.php b/Tests/Resource/ScopeTranslationTest.php new file mode 100644 index 0000000..3752906 --- /dev/null +++ b/Tests/Resource/ScopeTranslationTest.php @@ -0,0 +1,63 @@ +.description` で表示する。 翻訳が無い scope は + * 翻訳キーがそのまま画面に出るため、 `scopes.available` との同期をテストで担保する。 + */ +final class ScopeTranslationTest extends TestCase +{ + #[DataProvider('localeProvider')] + public function testAllAvailableScopesHaveDescription(string $locale): void + { + $messages = Yaml::parseFile(__DIR__.'/../../Resource/locale/messages.'.$locale.'.yaml'); + $oauth = $messages['api']['admin']['oauth']; + + foreach (self::availableScopes() as $scope) { + $key = 'scope.'.$scope.'.description'; + self::assertArrayHasKey( + $key, + $oauth, + sprintf('scope `%s` の説明が messages.%s.yaml に定義されていない', $scope, $locale) + ); + self::assertNotSame('', trim((string) $oauth[$key])); + } + } + + /** + * @return string[][] + */ + public static function localeProvider(): array + { + return [['ja'], ['en']]; + } + + /** + * @return list + */ + private static function availableScopes(): array + { + $config = Yaml::parseFile(__DIR__.'/../../Resource/config/services.yaml'); + + return $config['league_oauth2_server']['scopes']['available']; + } +}