Skip to content

Unicode to English literals - #7

Open
Uuttssaavv wants to merge 17 commits into
sarbagyastha:developfrom
Uuttssaavv:unicode_to_english
Open

Unicode to English literals#7
Uuttssaavv wants to merge 17 commits into
sarbagyastha:developfrom
Uuttssaavv:unicode_to_english

Conversation

@Uuttssaavv

Copy link
Copy Markdown

Feature Request: Conversion from Nepali unicode to English Literals

@sarbagyastha
sarbagyastha changed the base branch from master to develop August 29, 2022 06:46

@sarbagyastha sarbagyastha left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution. I've added some comments please look into those.

Comment thread README.md Outdated
Comment on lines +230 to +231
print(NepaliUnicode.convert(
"sayau' thu''gaa fUlakaa haamii, euTai maalaa nepaalii"));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format the code and add a trailing comma.

Comment thread lib/src/unicode_to_english.dart Outdated
Comment thread lib/src/unicode_to_english.dart Outdated
Comment thread lib/src/unicode_to_english.dart Outdated
var splittedString = text.split('');
var convertedString = <String>[];
for (var i = 0; i < splittedString.length; i++) {
if (i < splittedString.length - 1 && splittedString[i + 1] == '\u094D') {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final <is?> = splittedString[i + 1] == '\u094D'; // give the variable name so that the check you're trying to perform becomes self-explanatory.

Comment thread lib/src/unicode_to_english.dart Outdated
Comment thread lib/src/unicode_to_english.dart Outdated
convertedString.add(fullStr);
} else if (splittedString[i] != '\u094D') {
convertedString
.add(_unicodeMap[splittedString[i]] ?? splittedString[i]);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add missing trailing comma

Comment thread lib/src/unicode_to_english.dart Outdated
var convertedString = <String>[];
for (var i = 0; i < splittedString.length; i++) {
if (i < splittedString.length - 1 && splittedString[i + 1] == '\u094D') {
var fullStr = _unicodeMap[splittedString[i]].toString();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by fullStr here ?

Comment thread lib/src/unicode_to_english.dart Outdated
Comment on lines +29 to +32
convertedString[i - 1] = convertedString[i - 1].toString();
if (convertedString[i - 1].endsWith('a')) {
convertedString[i - 1] = convertedString[i - 1]
.substring(0, convertedString[i - 1].length - 1);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convertedString[i - 1] is being repeated multiple times, please extract it a variable.

Comment thread lib/src/unicode_to_english.dart Outdated
for (var i = 0; i < convertedString.length; i++) {
if (_symbolMap[convertedString[i]] != null) {
convertedString[i - 1] = convertedString[i - 1].toString();
if (convertedString[i - 1].endsWith('a')) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was the check needed, please add a comment.

Comment thread lib/src/unicode_to_english.dart Outdated
Comment on lines +37 to +38
_text = convertedString.join('');
return _text;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be return directly.

Comment thread README.md Outdated
Comment on lines +230 to +233
print(NepaliUnicode.convert(
"sayau' thu''gaa fUlakaa haamii, euTai maalaa nepaalii",
));
// सयौं थुँगा फूलका हामी, एउटै माला नेपाली

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still not properly formatted.

Comment thread README.md
### Unicode to English iterals
Converts Nepali Unicode into English literals.
```dart
print(NepaliUnicode.convert("सयौं थुँगा फूलका हामी, एउटै माला नेपाली"));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct ?

Comment on lines +33 to +34
preecedingCharacter =
preecedingCharacter.substring(0, preecedingCharacter.length - 1);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this used ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants