Skip to content

Generate platform specific string/translation files from a single source file. Currently supports iOS and Android.

Notifications You must be signed in to change notification settings

BenMMcLean/pkl-strings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pkl-strings

Generate platform specific string/translation files from a single source file. Currently supports iOS and Android.

Usage

Stable Preview

Make a new source file amending strings.pkl and override localizable:

amends "package://benm.cl/pkl-strings/pkl-strings@<version>.zip"

localizable = new Localizable {
    languages = new Listing {
        new Language {
            code = "en"
            strings = new Listing {
                new SingleResourceString {
                    name = "single"
                    value = "TestValue"
                },
                new QuantityResourceString {
                    name = "quantity_positional"
                    options = new Listing {
                        new QuantityOption {
                            quantity = "one"
                            value = "%d Thing"
                        }
                        new QuantityOption {
                            quantity = "other"
                            value = "%d Things"
                        }
                    }
                }
            }
        }
    }
}

This file can then be exported as an Android strings.xml and iOS Localizable.xcstrings using the command

pkl eval file.pkl -m .

This will automatically render the localized strings into an android and apple directory for Android strings and iOS strings respectively.

About

Generate platform specific string/translation files from a single source file. Currently supports iOS and Android.

Topics

Resources

Stars

Watchers

Forks