Skip to content

Commit

Permalink
chore(crate): Spin up space for a French implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Oct 27, 2024
1 parent 94c60c5 commit c008a5b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ licensedir = $(datarootdir)/licenses/$(TRANSFORMED_PACKAGE_NAME)
bin_PROGRAMS = decasify
decasify_SOURCES = src/bin/decasify.rs src/content.rs src/cli.rs src/lib.rs src/types.rs src/traits.rs
decasify_SOURCES += src/lua.rs src/python.rs src/wasm.rs
decasify_SOURCES += src/en.rs src/tr.rs
decasify_SOURCES += src/en.rs src/fr.rs src/tr.rs
EXTRA_decasify_SOURCES = tests/cli.rs tests/lib.rs
EXTRA_DIST = pyproject.toml spec/decasify_spec.lua tests/test_all.py plugin/decasify.lua sile/decasify.lua
dist_doc_DATA = README.md CHANGELOG.md
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Natural Language :: English",
"Natural Language :: French",
"Natural Language :: Turkish",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
Expand Down
20 changes: 20 additions & 0 deletions src/fr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-FileCopyrightText: © 2023 Caleb Maclennan <caleb@alerque.com>
// SPDX-License-Identifier: LGPL-3.0-only

use crate::{Chunk, StyleGuide};

pub fn titlecase(_chunk: Chunk, _style: StyleGuide) -> String {
todo!();
}

pub fn lowercase(_chunk: Chunk) -> String {
todo!();
}

pub fn uppercase(_chunk: Chunk) -> String {
todo!();
}

pub fn sentencecase(_chunk: Chunk) -> String {
todo!();
}
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub mod python;
pub mod wasm;

mod en;
mod fr;
mod tr;

/// Convert a string to a specific case following typesetting conventions for a target locale
Expand Down Expand Up @@ -62,6 +63,7 @@ pub fn titlecase(
let style: StyleGuide = style.into();
match locale {
Locale::EN => en::titlecase(chunk, style),
Locale::FR => fr::titlecase(chunk, style),
Locale::TR => tr::titlecase(chunk, style),
}
}
Expand All @@ -72,6 +74,7 @@ pub fn lowercase(chunk: impl Into<Chunk>, locale: impl Into<Locale>) -> String {
let locale: Locale = locale.into();
match locale {
Locale::EN => en::lowercase(chunk),
Locale::FR => fr::lowercase(chunk),
Locale::TR => tr::lowercase(chunk),
}
}
Expand All @@ -82,6 +85,7 @@ pub fn uppercase(chunk: impl Into<Chunk>, locale: impl Into<Locale>) -> String {
let locale: Locale = locale.into();
match locale {
Locale::EN => en::uppercase(chunk),
Locale::FR => fr::uppercase(chunk),
Locale::TR => tr::uppercase(chunk),
}
}
Expand All @@ -92,6 +96,7 @@ pub fn sentencecase(chunk: impl Into<Chunk>, locale: impl Into<Locale>) -> Strin
let locale: Locale = locale.into();
match locale {
Locale::EN => en::sentencecase(chunk),
Locale::FR => fr::sentencecase(chunk),
Locale::TR => tr::sentencecase(chunk),
}
}
1 change: 1 addition & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
pub enum Locale {
#[default]
EN,
FR,
TR,
}

Expand Down

0 comments on commit c008a5b

Please sign in to comment.