Add LocalizedStringKey + Bundle init overloads to all text-bearing OUDS components#1369
Open
Add LocalizedStringKey + Bundle init overloads to all text-bearing OUDS components#1369
Conversation
16 tasks
…OUDS components Agent-Logs-Url: https://github.com/Orange-OpenSource/ouds-ios/sessions/5afc98de-b850-404a-9a71-2a015b99c709 Co-authored-by: pylapp <7559007+pylapp@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update button component to use LocalizedStringKey and Bundle
Add LocalizedStringKey + Bundle init overloads to all text-bearing OUDS components
Mar 27, 2026
Member
|
To test, sue the design system toolbox and update //
// Software Name: OUDS iOS
// SPDX-FileCopyrightText: Copyright (c) Orange SA
// SPDX-License-Identifier: MIT
//
// This software is distributed under the MIT license,
// the text of which is available at https://opensource.org/license/MIT/
// or see the "LICENSE" file for more details.
//
// Authors: See CONTRIBUTORS.txt
// Software description: A SwiftUI components library with code examples for Orange Unified Design System
//
import OUDSSwiftUI
import SwiftUI
struct MainView: View {
@Environment(\.theme) private var theme
var body: some View {
OUDSTabBar(selected: 3, count: 4) {
TokensPage()
.tabItem {
Label("app_bottomBar_tokens_label", image: "design-token")
}
.tag(0)
ComponentsPage()
.tabItem {
Label("app_bottomBar_components_label", image: "component-atom")
}
.tag(1)
AboutPage()
.tabItem {
Label("app_bottomBar_about_label", image: "info-fill")
}
.tag(2)
DebugPage()
.tabItem {
Label("Debug", systemImage: "gear")
}
.tag(2)
}.oudsAccentColor(theme.colors.contentBrandPrimary)
}
}
struct DebugPage: View {
var body: some View {
VStack {
// Raw string
OUDSButton("Foo") {}
// Local string
OUDSButton("app_components_alert_alertMessage_closeButton_tech") {}
// Lib string
OUDSButton("core_checkboxPicker_indeterminate_hint_a11y", bundle: Bundle.OUDSComponents) {}
}
}
} |
e30712a to
c1ebbcd
Compare
c1ebbcd to
7902f2f
Compare
Open
12 tasks
Member
|
Note @ludovic35 |
Signed-off-by: Pierre-Yves Lapersonne <pierreyves.lapersonne@orange.com>
7902f2f to
cfae55f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Components with text parameters only accepted
String, making it impossible for library consumers to load strings from a customBundle(e.g.,Bundle.modulein a Swift Package). This addsLocalizedStringKey-based init overloads matching the SwiftUI API convention.Changes
New internal helper
LocalizedStringKey+keyString.swift: Mirror-basedkeyStringextraction +resolved(tableName:bundle:)wrappingNSLocalizedString. Resolves at init time — no rendering changes needed.New init overloads on all text-bearing components, each accepting
(_ key: LocalizedStringKey, tableName: String? = nil, bundle: Bundle = .main, comment: StaticString? = nil, ...):OUDSButton(text-only, text+icon)OUDSLink(text-only/icon, indicator)OUDSSuggestionChip,OUDSFilterChip(text-only, icon+text)OUDSChipPicker(title, all 3 selection modes)OUDSBulletList.ItemOUDSCheckboxItem,OUDSSwitchItem,OUDSRadioItemOUDSTag(label + loadingLabel via dedicatedloadingKey:parameter)OUDSTextInput,OUDSPasswordInputOUDSAlertMessage,OUDSInlineAlertCHANGELOG updated under
[Unreleased]Usage
All new inits delegate to the existing
String-based inits after resolution, so existing validation, accessibility, and rendering logic is fully preserved.Related issues
Closes #1364
Motivation & Context
Library authors embedding OUDS in a Swift Package need to load localized strings from
Bundle.module, not justBundle.main. Without this, they must pre-resolve strings manually before passing them to components.Types of change
Previews
No UI change — API addition only.
Checklist
Contribution
Accessibility
Design
Development
Documentation
Checklist (for Core Team only)
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.