share_localization is a command-line tool that shares localization files for iOS, Flutter, and Android projects.
It ensures that localization strings are consistent across different languages and platforms.
for each platform, it generates files with localizations in the format of the platform.
- ios:
swiftandxcstringsfiles - flutter:
dartcommon and locale files - android:
xmllocale files
- This tool is still in development and may not work as expected.
- Feel free to share your ideas and suggestions for improving this project!
To install the tool globally:
dart pub global activate --source git git@github.com:EvGeniyLell/share_localization.gitTo install from a specific branch:
dart pub global activate --source git git@github.com:EvGeniyLell/share_localization.git --git-ref BranchNameThe command-line tool expects to find the settings.json file in the working directory.
The settings file should be formatted as follows:
languages:
description: >-
Language codes you want to share.
The first language will be used for descriptions.
type: List
item:
type: String
sources_folder:
description: Folder with localization files.
type: String (required)
# Next, you can see custom options for each supported platform.
# If you don't need to share localizations to some platform,
# just remove it from the settings.
ios:
description: iOS specific options.
type: Object? (optional)
object:
bundle_name:
description: >-
Optional name of localizations bundles.
Use it if you have the localizations not in the main bundle.
type: String? (optional)
default: null
class_access_level:
description: >-
Access level for generated Swift classes.
Can be open/public/internal/fileprivate/private or null.
type: String (optional)
default: null
destination_folder:
description: >-
Generated files will be put here.
Supports path back step with `../../`.
type: String (required)
flutter:
description: Flutter specific options.
type: Object? (optional)
object:
destination_folder:
description: >-
Generated files will be put here.
Supports path back step with `../../`.
type: String (required)
android:
description: Android specific options.
type: Object? (optional)
object:
use_camel_case:
description: >-
Optional flag to use camelCase for keys.
type: Boolean? (optional)
default: false
use_file_prefix_for_keys:
description: >-
Optional flag to add file name as prefix to keys.
type: Boolean? (optional)
default: false
destination_folder:
description: >-
Generated files will be put here.
Supports path back step with `../../`.
type: String (required)You should put your localization files in the folder with the name specified in the settings.
languages:
description: >-
Language codes supported in the bundle.
type: List
item:
type: String
keys:
description: Localization keys.
type: Map
key:
description: Unique key of localization.
type: String
value:
object:
comment:
description: Comment for localization.
type: String
arguments:
description: Optional list of argument types and names.
type: List? (optional)
item:
object:
name:
type: String
type:
type: String
allowed_values:
- String
- Int
- Double
localizations:
type: Map
key:
description: Language code.
type: String
value:
description: Localization value.
type: String