fix : 언어팩 추가 및 내용 추가

This commit is contained in:
2025-08-25 17:26:20 +09:00
parent fe7d761bf6
commit 6307fdc1dc
4 changed files with 159 additions and 4 deletions

35
lang/en/error.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
/**
* System/Domain error messages (client-facing, fixed strings)
* - Not DB-driven
* - Used in global handler/service exceptions
* - Example: throw new NotFoundHttpException(__('error.not_found'));
*/
return [
// 4xx Common
'not_found' => 'The requested URI or data was not found.', // 404
'tenant_id' => 'No active tenant is set.', // 400 (Service::tenantId() missing)
'unauthenticated' => 'Authentication failed.', // 401
'forbidden' => 'You do not have permission for this request.', // 403
'bad_request' => 'Invalid request.', // 400
// Validation / Parameters
'validation_failed' => 'Request data validation failed.', // 422
'missing_parameter' => 'A required parameter is missing.', // 400
// Resource-specific (optional, with :resource placeholder)
'not_found_resource' => ':resource could not be found.', // 404
// Business rules
'duplicate' => 'Duplicate data exists.',
'conflict' => 'The request conflicts with the current state.', // 409
'state_invalid' => 'The current state does not allow this operation.', // 400/409
// Server errors
'server_error' => 'An internal server error occurred.', // 5xx
];

48
lang/en/message.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
/**
* Success / Info / General messages (non-error)
* - For API normal response "message" field
* - Use common keys and resource-specific nested keys
* - Example: return ApiResponse::success($data, __('message.created'));
*/
return [
// Common (CRUD / convenience)
'fetched' => 'Fetched successfully.',
'created' => 'Created successfully.',
'updated' => 'Updated successfully.',
'deleted' => 'Deleted successfully.',
'restored' => 'Restored successfully.',
'toggled' => 'Status updated successfully.',
'bulk_upsert' => 'Bulk save completed successfully.',
'reordered' => 'Reorder completed successfully.',
'no_changes' => 'No changes detected.',
// Auth / Session
'login_success' => 'Login successful.',
'logout_success' => 'You have been logged out.',
'signup_success' => 'Sign-up completed successfully.',
// Tenant / Context
'tenant_switched' => 'Active tenant has been switched.',
// Resource-specific details
'product' => [
'created' => 'Product has been created.',
'updated' => 'Product has been updated.',
'deleted' => 'Product has been deleted.',
'toggled' => 'Product status has been updated.',
],
'bom' => [
'fetched' => 'BOM items have been fetched.',
'bulk_upsert' => 'BOM items have been saved.',
'reordered' => 'BOM order has been updated.',
],
'category' => [
'fields_saved' => 'Category fields have been saved.',
'template_saved' => 'Category template has been saved.',
'template_applied' => 'Category template has been applied.',
],
];

View File

@@ -1,7 +1,31 @@
<?php
declare(strict_types=1);
/**
* 시스템/도메인 에러 메시지 (클라이언트 피드백용 고정 문자열)
* - DB 데이터 아님
* - 공통 핸들러/서비스에서 예외 메시지로 사용
* - 예: throw new NotFoundHttpException(__('error.not_found'));
*/
return [
'tenant_id' => '활성 테넌트 없음',
// 4xx 공통
'not_found' => '존재하지 않는 URI 또는 데이터입니다.', // 404 일반
'tenant_id' => '활성 테넌트가 없습니다.', // 400 (Service::tenantId() 미설정)
'unauthenticated' => '인증에 실패했습니다.', // 401
'forbidden' => '요청에 대한 권한이 없습니다.', // 403
'bad_request' => '잘못된 요청입니다.', // 400 (검증 외 일반 케이스)
// 검증/파라미터
'validation_failed' => '요청 데이터 검증에 실패했습니다.', // 422
'missing_parameter' => '필수 파라미터가 누락되었습니다.', // 400
// 리소스별 (선택: :resource 자리표시자 사용)
'not_found_resource' => ':resource 정보를 찾을 수 없습니다.', // 예: __('error.not_found_resource', ['resource' => '제품'])
// 비즈니스 규칙
'duplicate' => '중복된 데이터가 존재합니다.',
'conflict' => '요청이 현재 상태와 충돌합니다.', // 409
'state_invalid' => '현재 상태에서는 처리할 수 없습니다.', // 409/400
// 서버 오류
'server_error' => '서버 처리 중 오류가 발생했습니다.', // 5xx 일반
];

48
lang/ko/message.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
/**
* 성공/안내/일반 메시지 (비에러)
* - API 정상 응답의 message 필드용
* - 도메인 공통 키와 리소스별 하위 그룹을 혼합 사용
* - 예: return ApiResponse::success($data, __('message.created'));
*/
return [
// 공통 (CRUD/편의)
'fetched' => '조회 성공',
'created' => '등록 성공',
'updated' => '수정 성공',
'deleted' => '삭제 성공',
'restored' => '복구 성공',
'toggled' => '상태 변경 성공',
'bulk_upsert' => '대량 저장 성공',
'reordered' => '정렬 변경 성공',
'no_changes' => '변경 사항이 없습니다.',
// 인증/세션
'login_success' => '로그인 성공',
'logout_success' => '로그아웃 되었습니다.',
'signup_success' => '회원가입이 완료되었습니다.',
// 테넌트/컨텍스트
'tenant_switched' => '활성 테넌트가 전환되었습니다.',
// 리소스별 세부 (필요 시)
'product' => [
'created' => '제품이 등록되었습니다.',
'updated' => '제품이 수정되었습니다.',
'deleted' => '제품이 삭제되었습니다.',
'toggled' => '제품 상태가 변경되었습니다.',
],
'bom' => [
'fetched' => 'BOM 항목을 조회했습니다.',
'bulk_upsert' => 'BOM 항목이 저장되었습니다.',
'reordered' => 'BOM 정렬이 변경되었습니다.',
],
'category' => [
'fields_saved' => '카테고리 필드가 저장되었습니다.',
'template_saved' => '카테고리 템플릿이 저장되었습니다.',
'template_applied' => '카테고리 템플릿이 적용되었습니다.',
],
];