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

#536 Add documentation for theme and internationalization #829

Open
wants to merge 1 commit into
base: qualif
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- [Doc] Add documentation for theme and internationalization ([#536](https://github.com/Orange-OpenSource/ods-ios/issues/536))
- [Doc] Add Documentation versionning ([#223](https://github.com/Orange-OpenSource/ods-ios/issues/223))
- [DemoApp] Add privacy manifest ([#798](https://github.com/Orange-OpenSource/ods-ios/issues/798))

Expand Down
2 changes: 1 addition & 1 deletion docs/_data/data_menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: ""
toc2:
- title: Get Started
subfolderitems:
- page: Integration
- page: Instructions
url: /index.html

- title: Guidelines
Expand Down
41 changes: 38 additions & 3 deletions docs/home_content.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,54 @@ The Orange Design System has been implemented in a code library that provides:

Using these resources will allow you to create Orange branded applications faster and will inherit all the work that was done to make sure that all presented codes are fully tested regarding the brand and the accessibility compliance.

The Orange Design System framework supports iOS 15 and later.
The Orange Design System framework supports **iOS 15 and later**.

## Instructions

1. Depend on our library

### Swift Package Manager

The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.

Once you have your Swift package set up, adding ODS as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
Once you have your Swift package set up, adding ODS as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift` and add products into your targets:
- OrangeDesignSystem for the core of the library
- OrangeTheme for the theme of the orange brand

```swift
dependencies: [
.package(url: "https://github.com/Orange-OpenSource/ods-ios.git", .upToNextMajor(from: "1.1.0"))
]
],
targets: [
.target(name: "MyLibrary", dependencies: [
.product(name: "OrangeDesignSystem", package: "ods-ios"),
.product(name: "OrangeTheme", package: "ods-ios")]),
```

2 Change your app theme to inherit from a Orange Design theme

Because ODS support multi-theme, you should pass the __OrangeTheme__ as theme configuration to use the Orange theme.
Note that Orange theme supports both light and dark mode.

Use the ODSThemeableView as your main Content view which will add the theme in the environement, update navigationbar and tabbar according to colors stored in the theme object.


```swift
@main
struct YourApplication: App {

var body: some Scene {
WindowGroup {
ODSThemeableView(theme: OrangeThemeFactory().theme) {
ContentView()
}
}
}
}

Note: Use another provided __ODSTheme__ implementation if you want to use a custom theme. For example __InnovationCupThemeFactory().theme__.

3. Internationalization

Today, the __OrangeDesignSystem__ core library does not define any strings. But some modules (like About) define their own strings in the default language (English).
In order to translate those strings in a new language, you need to insert into the Localizable.strings file of your application, the keys define by modules and the associated traduction.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: main
title: Integration
title: Instructions
description: Getting started with Orange Design System for iOS
---

Expand Down
2 changes: 1 addition & 1 deletion docs/index_content.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: detail
title: Integration
title: Instructions
description: Getting started with Orange Design System for iOS
---

Expand Down
6 changes: 6 additions & 0 deletions docs/modules/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,9 @@ public struct MyItemToDisplayText: ODSAboutListItemConfig {
}
```

## Internationalization

The about module defines some strings sored in the Localizable.strings file provided with the framework. All keys are prefixed by "modules.about.". Today, the module supports only the english language.

To suopport a new langauge, add a Localizable.strings file (associeted to this langauge) to your main bundle. Then, add those keys and the associated translation for the language.
Indeed, the module tries to load first strings from this file. If there is no string found, it uses the string from the default language file.