turkish 0.1.0+1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 67

turkish

This library provides these functions for Turkish language:

  • Converting strings to lower, upper and title case.
  • Regular and ignore case string sorting.

Casing operations does not work correctly in Dart core libraries because Dart uses default unicode mappings. Default case mappings fails for Turkish i->İ and I->ı conversions.

This library may not be necessary for Flutter or web projects if they use underlying system methods for locale specific text operations. But it can be handy when that is not the case.

Current implementation does not handle two code-unit variations. Complete special casing rules are defined here.

Usage

Add this line to pubspec.yaml:

turkish: '>=0.1.0'

Add this line to the import section:

import 'package:turkish/turkish'

There is a single object instance exposed from library called turkish. All operations are accessed through this object.

Usage Example:

import 'package:turkish/turkish';
...
var inputL = "kısa şiir";
print("UpperCase for [$inputL]");
print("Default= ${inputL.toUpperCase()}, Turkish=${turkish.toUpperCase(inputL)}\n");

var inputU = "KISA ŞİİR";
print("LowerCase for [$inputU]");
print("Default= ${inputU.toLowerCase()}, Turkish=${turkish.toLowerCase(inputU)}\n");

var list = ["Az","ağ","aç","ad"];
print("Input= $list");
print("Default Sort= ${list..sort()}");

list = ["Az","ağ","aç","ad"];
print("Turkish Sort= ${list..sort(turkish.comparator)}");

list = ["Az","ağ","aç","ad"];
print("Turkish Sort Ignore Case= ${list..sort(turkish.comparatorIgnoreCase)}");

Output:
UpperCase for [kısa şiir]
Default= KISA ŞIIR, Turkish=KISA ŞİİR

LowerCase for [KISA ŞİİR]
Default= kisa şiir, Turkish=kısa şiir

Input= [Az, ağ, aç, ad]
Default Sort= [Az, ad, aç, ağ]
Turkish Sort= [Az, aç, ad, ağ]
Turkish Sort Ignore Case= [aç, ad, ağ, Az]

0.1.0+1

  • Fix homepage in pub.yaml

0.1.0

  • Initial version, converted from dotless_i project.
  • Make it Dart2 compatible.
  • Add letters with circumflex to sorting mechanism.

example/example.dart

import 'package:turkish/turkish.dart';

main() {
  // upperCaseTr
  var inputL = "kısa şiir";
  print("UpperCase for [$inputL]");
  print("Default= ${inputL.toUpperCase()}, "
      "Turkish=${turkish.toUpperCase(inputL)}\n");

  // lowerCaseTr
  var inputU = "KISA ŞİİR";
  print("LowerCase for [$inputU]");
  print("Default= ${inputU.toLowerCase()}, "
      "Turkish=${turkish.toLowerCase(inputU)}\n");

  // sort Default
  var list = ["Az", "ağ", "aç", "ad"];
  print("Input= $list");
  print("Default Sort= ${list..sort()}");

  // sort Turkish  
  list = ["Az", "ağ", "aç", "ad"];
  print("Turkish Sort= ${list..sort(turkish.comparator)}");

  // sort Turkish ignore case  
  list = ["Az", "ağ", "aç", "ad"];
  print("Turkish Sort Ignore Case= "
      "${list..sort(turkish.comparatorIgnoreCase)}");
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  turkish: ^0.1.0+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:turkish/turkish.dart';
  
Version Uploaded Documentation Archive
0.1.0+1 Jan 26, 2018 Go to the documentation of turkish 0.1.0+1 Download turkish 0.1.0+1 archive
0.1.0 Jan 26, 2018 Go to the documentation of turkish 0.1.0 Download turkish 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
67
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:turkish/turkish.dart.

Health suggestions

Format lib/turkish.dart.

Run dartfmt to format lib/turkish.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.0 <3.0.0
Dev dependencies
test >=0.12.30 <0.13.0