Skip to content

[REFACTOR/#283] 하드코딩된 문자열 리소스를 추출하여 i18n 적용 준비 합니다.#284

Merged
MoonsuKang merged 12 commits intodevelopfrom
refactor/#283-extract-strings-i18n
Jun 29, 2025
Merged

[REFACTOR/#283] 하드코딩된 문자열 리소스를 추출하여 i18n 적용 준비 합니다.#284
MoonsuKang merged 12 commits intodevelopfrom
refactor/#283-extract-strings-i18n

Conversation

@MoonsuKang
Copy link
Contributor

@MoonsuKang MoonsuKang commented Jun 21, 2025

📌 ISSUE

closed #283

📄 Work Description

  • 기존에 하드코딩되어 있던 텍스트를 추출했습니다.
  • AM/PM 문자열 사용 부분을 TimePeriod enum을 활용하도록 변경하였고, enum 내부에 @Composable fun getLabel()을 정의해 리소스를 통해 라벨을 가져오도록 리팩터링했습니다.
  • WeekHeader 컴포넌트에 WeekLang enum을 도입하여, 요일 라벨을 한글/영어로 선택적으로 보여줄 수 있도록 구조 개선했습니다.
  • YearMonthPicker의 연도와 월 텍스트를 상수(MIN_YEAR, MAX_YEAR)와 확장 함수(toYearLabel(), parseYear() 등)를 활용하는 방식으로 재구성했습니다.

✨ PR Point

정규식(text\s*=\s*"[^"]+", Text(\s*"[^"]+")을 통한 하드코드 된 파일 탐색 후 제거

Image

📸 ScreenShot/Video

Summary by CodeRabbit

  • New Features

    • Introduced support for localized year and month labels and AM/PM time periods, improving internationalization across date and time pickers.
    • Enhanced weekday headers to support both Korean and English languages.
  • Bug Fixes

    • Improved type safety and localization for time selection by replacing string-based AM/PM handling with a strongly typed enum.
  • Refactor

    • Removed the circular Next button component from the UI.
    • Replaced all hardcoded UI text with localized string resources throughout the app for better language support and easier updates.
  • Documentation

    • Expanded and reorganized string resources to cover new dialogs, buttons, error messages, and accessibility labels.

@MoonsuKang MoonsuKang requested a review from SYAAINN June 21, 2025 08:43
@MoonsuKang MoonsuKang self-assigned this Jun 21, 2025
@MoonsuKang MoonsuKang added ♻️ REFACTOR 코드 리팩토링(전면 수정) 🔥 민재 민재 🌊 문수 문수 labels Jun 21, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jun 21, 2025

Walkthrough

This update removes hardcoded UI strings throughout the codebase, replacing them with references to localized string resources to support internationalization. It introduces utility functions for localized year/month labels, adds a TimePeriod enum for AM/PM handling, and refactors related components to use these new abstractions. One unused button component is deleted.

Changes

File(s) Change Summary
.../auth/component/button/NextButton.kt Removed the NextButton composable UI component.
.../auth/component/timepicker/BottomSheetTimePicker.kt Refactored AM/PM handling to use TimePeriod enum and string resources; updated callback signatures.
.../auth/signup/page/NicknamePage.kt Replaced hardcoded UI strings with string resource references.
.../auth/timereminder/TimeReminderScreen.kt
.../TimeReminderViewModel.kt
Switched AM/PM logic to use TimePeriod enum and localized labels; updated function signatures.
.../component/bottomsheet/DiaryDeleteSheet.kt
.../writediary/component/bottomsheet/DeleteWriteDiaryBottomSheet.kt
Replaced hardcoded "삭제하기" with string resource.
.../component/timepicker/YearMonthPicker.kt Refactored to use integer-based year/month lists and localized label utilities.
.../home/calendar/component/DailyDiaryListItem.kt Replaced hardcoded strings with string resource references.
.../home/calendar/component/WeekHeader.kt Internationalized weekday labels; added WeekLang enum and preview composables.
.../home/component/CloverCount.kt
.../home/component/DiaryStateButton.kt
.../home/component/YearAndMonthTitle.kt
Replaced hardcoded display strings with string resources.
.../home/screen/HomeScreen.kt Replaced all hardcoded UI strings with string resource references.
.../replyloading/component/QuickReplyAdButton.kt Replaced hardcoded button text with string resource.
.../splash/SplashScreen.kt Replaced all dialog texts with string resource references.
.../writediary/component/button/AddDiaryEntryFAB.kt
.../button/SendButton.kt
Replaced hardcoded button text with string resource.
.../writediary/component/textfield/WriteDiaryTextField.kt Replaced hardcoded placeholder and warning with string resources.
.../utils/extension/TimePeriod.kt Added TimePeriod enum with localized label support.
.../utils/extension/YearMonthLabelUtil.kt Added utility for localized year/month labels and constants.
.../res/values/strings.xml Added and reorganized string resources for all UI text and formats.

Sequence Diagram(s)

sequenceDiagram
    participant UI as Composable UI
    participant Resources as String Resources
    participant Utils as Extension/Enum Utils

    UI->>Resources: Fetch localized string via stringResource()
    UI->>Utils: Call TimePeriod.getLabel() or toLocalizedYearLabel()
    Utils->>Resources: Fetch corresponding string resource
    UI->>UI: Display localized text in UI components
Loading

Assessment against linked issues

Objective Addressed Explanation
Remove hardcoded strings from UI components and replace with string resources (#283)
Refactor AM/PM handling in BottomSheetTimePicker and TimeReminderScreen to support i18n (#283)
Prepare codebase for internationalization by extracting UI text (#283)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Removal of NextButton composable (app/src/main/java/com/sopt/clody/presentation/ui/auth/component/button/NextButton.kt) The removal of this UI component is not mentioned in the linked issue about string resource extraction or i18n preparation.

Suggested labels

🎨 UI

Poem

A bunny hopped through code today,
Swapping strings the global way.
From AM to PM, months and years,
Now every label’s crystal clear!
With enums, resources, and i18n cheer,
The world can read—no matter where they peer!
🐇🌍✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d8a1111 and 05a5d8b.

📒 Files selected for processing (22)
  • app/src/main/java/com/sopt/clody/presentation/ui/auth/component/button/NextButton.kt (0 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/auth/component/timepicker/BottomSheetTimePicker.kt (5 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/auth/signup/page/NicknamePage.kt (3 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/auth/timereminder/TimeReminderScreen.kt (4 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/auth/timereminder/TimeReminderViewModel.kt (2 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/component/bottomsheet/DiaryDeleteSheet.kt (2 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/component/timepicker/YearMonthPicker.kt (5 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/home/calendar/component/DailyDiaryListItem.kt (4 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/home/calendar/component/WeekHeader.kt (2 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/home/component/CloverCount.kt (1 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/home/component/DiaryStateButton.kt (6 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/home/component/YearAndMonthTitle.kt (3 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/home/screen/HomeScreen.kt (8 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/replyloading/component/QuickReplyAdButton.kt (2 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/splash/SplashScreen.kt (3 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/writediary/component/bottomsheet/DeleteWriteDiaryBottomSheet.kt (2 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/writediary/component/button/AddDiaryEntryFAB.kt (2 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/writediary/component/button/SendButton.kt (2 hunks)
  • app/src/main/java/com/sopt/clody/presentation/ui/writediary/component/textfield/WriteDiaryTextField.kt (3 hunks)
  • app/src/main/java/com/sopt/clody/presentation/utils/extension/TimePeriod.kt (1 hunks)
  • app/src/main/java/com/sopt/clody/presentation/utils/extension/YearMonthLabelUtil.kt (1 hunks)
  • app/src/main/res/values/strings.xml (5 hunks)
💤 Files with no reviewable changes (1)
  • app/src/main/java/com/sopt/clody/presentation/ui/auth/component/button/NextButton.kt
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (67)
app/src/main/java/com/sopt/clody/presentation/utils/extension/TimePeriod.kt (2)

8-11: Use of enum with resource IDs is correct
The TimePeriod enum centralizes AM/PM labels and ensures type safety via @StringRes.


13-15: Composable label retrieval is appropriate
Using stringResource(labelResId) in a @Composable function cleanly abstracts localization.

app/src/main/java/com/sopt/clody/presentation/ui/writediary/component/button/AddDiaryEntryFAB.kt (2)

26-26: Import for stringResource added
Required import to support localized string lookups in Compose.


89-89: Localized FAB label applied
Replacing the hardcoded "추가하기" with stringResource(R.string.write_diary_add_entry_fab) aligns with i18n goals.

Ensure that R.string.write_diary_add_entry_fab is defined across all relevant strings.xml locales.

app/src/main/java/com/sopt/clody/presentation/ui/writediary/component/bottomsheet/DeleteWriteDiaryBottomSheet.kt (2)

21-21: Import for stringResource added
Needed to resolve localized text in the delete button.


64-64: Localized delete button text applied
Using stringResource(R.string.bottom_sheet_delete_button) removes hardcoded text and supports localization.

Confirm that bottom_sheet_delete_button exists in all strings.xml variants.

app/src/main/java/com/sopt/clody/presentation/ui/replyloading/component/QuickReplyAdButton.kt (2)

17-17: Import for stringResource added
Import aligns with replacing hardcoded button text.


44-44: Localized ad button text applied
Replacing the literal with stringResource(R.string.loading_button_watch_ad_and_get_reply) supports i18n.

Verify that loading_button_watch_ad_and_get_reply is present in all locale files.

app/src/main/java/com/sopt/clody/presentation/ui/component/bottomsheet/DiaryDeleteSheet.kt (2)

21-21: Import for stringResource added
Enables use of localized resources for delete sheet text.


75-75: Localized delete sheet text applied
stringResource(R.string.bottom_sheet_delete_button) replaces the hardcoded label.

Ensure bottom_sheet_delete_button is defined in all required locales.

app/src/main/java/com/sopt/clody/presentation/ui/home/component/CloverCount.kt (2)

13-13: Proper imports added for string resource support.

Good addition of the necessary imports to support localized string resources.

Also applies to: 16-16


21-21: Excellent string resource implementation with parameter formatting.

The hardcoded string concatenation has been properly replaced with a parameterized string resource call, which correctly supports localization and maintains the dynamic clover count value.

app/src/main/java/com/sopt/clody/presentation/ui/home/component/YearAndMonthTitle.kt (3)

15-15: Proper import added for string resource support.

Good addition of the stringResource import to support localized strings.


26-26: Excellent parameterized string resource implementation.

The hardcoded string interpolation has been properly replaced with a parameterized string resource call that maintains the dynamic year and month values while supporting localization.


45-45: Nice formatting cleanup.

Good consolidation of the padding modifier parameters into a single line for better readability.

app/src/main/java/com/sopt/clody/presentation/ui/writediary/component/button/SendButton.kt (2)

14-14: Proper imports added for string resource support.

Good addition of the necessary imports to support localized string resources.

Also applies to: 16-16


38-38: Clean string resource implementation.

The hardcoded Korean string has been properly replaced with a string resource call, supporting localization without changing the component's functionality.

app/src/main/java/com/sopt/clody/presentation/ui/writediary/component/textfield/WriteDiaryTextField.kt (3)

33-33: Proper import added for string resource support.

Good addition of the stringResource import to support localized strings.


134-134: Excellent placeholder text localization.

The hardcoded Korean placeholder text has been properly replaced with a string resource, improving localization support for the text field hint.


169-169: Good warning message localization.

The hardcoded Korean warning message has been properly replaced with a string resource, ensuring consistent localization support for error messages.

app/src/main/java/com/sopt/clody/presentation/ui/auth/signup/page/NicknamePage.kt (4)

23-23: Proper import added for string resource support.

Good addition of the stringResource import to support localized strings.


89-89: Good button text localization.

The hardcoded Korean button text has been properly replaced with a string resource, improving localization support for the action button.


102-102: Excellent title text localization.

The hardcoded Korean title has been properly replaced with a string resource, ensuring the page title supports localization.


107-107: Good input hint localization.

The hardcoded Korean input hint has been properly replaced with a string resource, providing consistent localization support for user guidance text.

app/src/main/java/com/sopt/clody/presentation/ui/home/screen/HomeScreen.kt (6)

26-26: LGTM: Essential import for i18n refactoring.

Added stringResource import to support the string externalization throughout the file.


175-213: Excellent i18n implementation for the draft popup.

All hardcoded Korean strings in the popup have been systematically replaced with stringResource() calls, maintaining the same functionality while enabling proper localization support.


224-224: Toast message properly externalized.

The draft alarm toast message is now using string resources for better i18n support.


240-254: Continue draft dialog properly localized.

All dialog text elements (title, description, confirm/dismiss options) have been converted to use string resources consistently.


269-287: Delete diary dialog consistently localized.

Dialog text elements follow the same pattern as other dialogs, ensuring consistent i18n implementation across the UI.


378-378: Error messages properly externalized.

Both calendar state and delete diary error messages now use string resources, providing fallback for unknown errors where appropriate.

Also applies to: 393-393

app/src/main/java/com/sopt/clody/presentation/ui/home/calendar/component/DailyDiaryListItem.kt (3)

21-21: Import added for string resource support.

Essential import for the i18n refactoring changes in this file.


56-59: Excellent use of parameterized string resources.

The day of week formatting properly uses a string resource with parameter substitution, demonstrating best practice for localized text formatting.


83-83: User messages properly localized.

Both the draft presence message and empty diary list message are now using string resources for proper i18n support.

Also applies to: 99-99

app/src/main/java/com/sopt/clody/presentation/ui/home/component/DiaryStateButton.kt (2)

7-9: Required imports for string resource usage.

Added necessary imports to support string externalization throughout the component.


34-34: Complete button text localization.

All button text strings across different diary states (draft, invalid draft, reply available, write available) have been systematically converted to use string resources, ensuring consistent i18n support.

Also applies to: 43-43, 54-54, 63-63, 72-72

app/src/main/java/com/sopt/clody/presentation/ui/splash/SplashScreen.kt (3)

20-20: Import added for string localization.

Essential import for the dialog string externalization.


124-140: Soft update dialog properly localized.

All dialog elements (title, message with version parameter, confirm/dismiss buttons) are now using string resources for proper i18n support.


152-165: Hard update dialog consistently localized.

Dialog text elements follow the same localization pattern. Note the reuse of soft_update_confirm string resource for the hard update confirm button, which is appropriate if the button text is identical.

app/src/main/java/com/sopt/clody/presentation/ui/auth/component/timepicker/BottomSheetTimePicker.kt (5)

31-31: Excellent type safety improvement with TimePeriod enum.

The import and callback parameter change from raw String to TimePeriod enum significantly improves type safety and prevents potential AM/PM string-related bugs.

Also applies to: 37-37


79-80: Well-designed enum to label mapping.

Creates a clean separation between enum values and their localized display labels, enabling proper i18n while maintaining type safety.


103-103: Proper use of localized labels in picker.

The picker now displays localized AM/PM labels instead of hardcoded strings, supporting proper internationalization.


132-137: Robust label-to-enum conversion.

The implementation correctly converts selected labels back to TimePeriod enum values with a sensible fallback to TimePeriod.PM, preventing potential crashes from unexpected selections.


140-140: Button text properly localized.

Consistent with the overall i18n effort, the button text now uses string resources.

app/src/main/java/com/sopt/clody/presentation/ui/auth/timereminder/TimeReminderViewModel.kt (1)

82-96: Excellent refactoring to improve type safety and localization.

The migration from string-based AM/PM handling to the TimePeriod enum is a significant improvement:

  • Type safety prevents runtime errors from invalid period strings
  • The time conversion logic correctly handles 12-hour to 24-hour format
  • Using Locale.US ensures consistent formatting regardless of device locale
app/src/main/java/com/sopt/clody/presentation/utils/extension/YearMonthLabelUtil.kt (1)

7-16: Well-designed utility for localized date labels.

The utility provides a clean API for localized year/month formatting:

  • Extension functions offer intuitive usage
  • Proper use of stringResource for i18n support
  • Constants centralize the valid year range

Consider if the 2030 upper limit might need adjustment for long-term usage, but the current range seems appropriate for most use cases.

app/src/main/java/com/sopt/clody/presentation/ui/auth/timereminder/TimeReminderScreen.kt (2)

105-110: Consistent adoption of TimePeriod enum improves type safety.

The callback functions correctly use the TimePeriod enum instead of raw strings, maintaining consistency with the ViewModel changes and improving compile-time safety.


187-192: Proper localization of time display format.

The time display now uses stringResource with the getLabel() method from TimePeriod, providing proper i18n support while maintaining readable formatting.

app/src/main/java/com/sopt/clody/presentation/ui/component/timepicker/YearMonthPicker.kt (2)

42-50: Robust refactoring to integer-based year/month handling.

The transition from string-based to integer-based lists is a significant improvement:

  • More reliable data handling without string parsing
  • Proper bounds checking with coerceAtLeast(0)
  • Clean separation between data model (integers) and presentation (localized labels)

91-92: Excellent localization implementation with proper data mapping.

The approach correctly:

  • Maps integers to localized labels for display
  • Maps selected labels back to integers for the callback
  • Maintains data integrity throughout the selection process

Also applies to: 131-133

app/src/main/java/com/sopt/clody/presentation/ui/home/calendar/component/WeekHeader.kt (1)

56-72: Approve the dynamic label generation approach.

The component structure correctly supports dynamic language selection and provides a clean API for weekday display customization.

app/src/main/res/values/strings.xml (17)

4-9: Soft update dialog strings added for localization

The new soft_update_* entries correctly externalize the dialog title, message with placeholder, and button labels. Placeholder syntax and newline escape are valid.


11-14: Hard update dialog strings added for localization

The hard_update_* entries mirror the soft-update pattern for forced upgrades. Placeholder usage is correct.


20-24: Onboarding nickname prompt strings extracted

The nickname title, hint, and next-button labels are now localized. Use of \n for line breaks aligns with Android conventions.


67-67: Loading screen ad-watch button string added

loading_button_watch_ad_and_get_reply externalizes the newly introduced ad-watch flow label.


117-117: Diary list reply-check action string added

The diarylist_check_reply string covers the new “답장 확인” button in the diary list item.


118-121: Daily diary formatting strings added

New draft/empty state messages and item/day-of-week formats are correctly parameterized.


123-125: Home screen clover and date format strings added

The home_clover_count_format and home_year_and_month_format entries externalize dynamic counts and dates.


127-131: Home action buttons localized

New keys for continue draft, check reply, and write diary buttons are in place.


132-135: Home error messages externalized

All three error messages for data-load, unknown, and delete-diary flows are now localized.


137-142: Home draft-popup strings added

Title, description, guide, and button labels for the draft reminder popup are parameterized correctly.


144-145: Home draft alarm toast string added

The completion toast message for draft-alarm setup is now in resources.


147-151: Continue-draft dialog strings added

Dialog title, description, and button labels for resuming drafts are localized.


153-157: Delete-diary confirmation dialog strings added

The home screen’s delete-diary dialog entries are now in the string resources.


159-160: Accessibility label for month chooser added

home_icon_choose_month provides a content description for the month-picker icon.


206-209: Common component strings for bottom sheet and picker

Entries for delete button and year-month picker labels (bottom_sheet_delete_button, year_month_picker_*) are correctly extracted.


211-214: Time format strings for AM/PM and reminders added

time_am, time_pm, and time_reminder_time_format enable localized time-period labels and formatting.


216-217: Year and month format strings added

Standalone year_format and month_format entries support the picker utilities.

Comment on lines +24 to +53
fun DayOfWeek.toKoreanShortLabel(): String {
return when (this) {
DayOfWeek.SUNDAY -> "일"
DayOfWeek.MONDAY -> "월"
DayOfWeek.TUESDAY -> "화"
DayOfWeek.WEDNESDAY -> "수"
DayOfWeek.THURSDAY -> "목"
DayOfWeek.FRIDAY -> "금"
DayOfWeek.SATURDAY -> "토"
}
}

fun DayOfWeek.toEnglishShortLabel(): String {
return when (this) {
DayOfWeek.SUNDAY -> "Sun"
DayOfWeek.MONDAY -> "Mon"
DayOfWeek.TUESDAY -> "Tue"
DayOfWeek.WEDNESDAY -> "Wed"
DayOfWeek.THURSDAY -> "Thu"
DayOfWeek.FRIDAY -> "Fri"
DayOfWeek.SATURDAY -> "Sat"
}
}

fun DayOfWeek.getLabel(lang: WeekLang): String {
return when (lang) {
WeekLang.KOREAN -> this.toKoreanShortLabel()
WeekLang.ENGLISH -> this.toEnglishShortLabel()
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Critical: Hardcoded strings violate i18n principles.

While the WeekLang enum provides language selection flexibility, the extension functions still contain hardcoded Korean and English strings. This approach:

  • Won't support runtime locale changes
  • Prevents proper localization through Android's resource system
  • Is inconsistent with the rest of the PR's i18n approach

Replace the hardcoded strings with string resources:

fun DayOfWeek.toKoreanShortLabel(): String {
    return when (this) {
-        DayOfWeek.SUNDAY -> "일"
-        DayOfWeek.MONDAY -> "월"
+        DayOfWeek.SUNDAY -> stringResource(R.string.weekday_sunday_short_ko)
+        DayOfWeek.MONDAY -> stringResource(R.string.weekday_monday_short_ko)
        // ... continue for all days
    }
}

Or better yet, consider using a single extension function with stringResource and let the Android system handle locale selection automatically.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
app/src/main/java/com/sopt/clody/presentation/ui/home/calendar/component/WeekHeader.kt
between lines 24 and 53, the DayOfWeek extension functions use hardcoded Korean
and English strings, which breaks i18n best practices and prevents dynamic
locale changes. Refactor these functions to remove hardcoded strings and instead
retrieve the day labels from Android string resources using stringResource or a
similar mechanism. Ideally, consolidate into a single extension function that
uses stringResource to automatically handle localization based on the current
device locale, ensuring proper integration with Android's resource system and
runtime locale changes.

@MoonsuKang MoonsuKang removed the 🔥 민재 민재 label Jun 21, 2025
Copy link
Contributor

@SYAAINN SYAAINN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다! 이제 남은것은 영어버전 구현뿐 ㅋㅋ

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[p4]
스트링 추출 후에 다국어 지원으로 가는 방향이 아니라 이 방식으로 진행한 이유가 따로 있나요?
한국어, 한자, 영어를 제외하고 다른 방법 쓸 일이 있을까 싶긴한데 다국어 관련해서 추가 사항이 있으면 항상 이렇게 따로 추가해야 하는게 번거로울 수도 있지 않을까하는 생각이 드네요. 스트링 추출해서 언어 지원을 바꾸는 걸로 전부 대응하려는게 너무 딸깍적 사고일까요 ㅋㅋ

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

딱히 특별한 이유는 없고, EN/KR 두 가지 label만 가볍게 다룰 목적이었습니다.
중국어나 일본어 같은 건 고려하지 않았고, 기존 구조가 toKoreanShortLabel() 함수를 이미 사용하고 있어서 영어만 extension으로 자연스럽게 추가한 형태입니다.

@MoonsuKang MoonsuKang merged commit 445de44 into develop Jun 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♻️ REFACTOR 코드 리팩토링(전면 수정) 🌊 문수 문수

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] 하드코딩된 문자열 리소스를 추출하여 i18n 적용 준비 합니다.

2 participants