I18n#6
Open
Ninjapouet wants to merge 6 commits intoOCamlPro:masterfrom
Open
Conversation
added 6 commits
December 19, 2025 10:46
This RFC proposes a lightweight, format-agnostic codec library for encoding/decoding OCaml types. Key features: - Minimal dependencies (fmt only for core) - First-class codec values with combinators - Driver-based architecture for custom formats - PPX deriver for automatic codec generation - Streaming via composition (no special API) Includes state of the art analysis comparing ppx_deriving_yojson, ppx_protocol_conv, data-encoding, Repr, and ppx_sexp_conv.
The existing deriver approach allows composition ([@@deriving yojson, yaml]), so code duplication is not a valid criticism.
- Clarify users_codec example with type annotation - Use stdlib Out_channel instead of undefined write_file - Note that decode currently raises, improvement planned - Expand ppx_codec package structure to be more realistic - Note that binary driver example is simplified - Use "a few dozen lines" instead of precise estimate - Remove incorrect "not valid OCaml" comment on rank-2 type
Document an alternative approach using runtime type representations (like typerep or Repr) instead of direct code generation. Analyze trade-offs and options for using existing libraries vs defining our own.
Add ATD (Adaptable Type Definitions) as an IDL-based alternative in the state of the art section. Position codec and ATD as complementary: ATD for cross-language API contracts, codec for OCaml-native serialization with full type system expressivity.
Propose a comprehensive i18n solution targeting parity with Java/JavaScript, built on Unicode MessageFormat 2.0 (MF2) and ICU4X. Three components: - ocaml-icu4x: bindings to ICU4X for locale-aware formatting (numbers, dates, currencies), collation, plural rules, and text segmentation - ppx_i18n: compile-time type-safe message translation with MF2 syntax, contract-based verification, and asymmetric localization support - ocaml-i18n-tool: CLI for translation workflow (extraction, validation, format conversion, coverage statistics) Includes state of the art comparison across 7 mainstream languages, 4-phase implementation plan, and architectural decision records.
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.
An internationalization proposal for OCaml.