Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode to English literals #7

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

Uuttssaavv
Copy link

Feature Request: Conversion from Nepali unicode to English Literals

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

@sarbagyastha sarbagyastha left a comment

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.

README.md Outdated
Comment on lines 230 to 231
print(NepaliUnicode.convert(
"sayau' thu''gaa fUlakaa haamii, euTai maalaa nepaalii"));
Copy link
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.

lib/src/unicode_to_english.dart Outdated Show resolved Hide resolved
lib/src/unicode_to_english.dart Outdated Show resolved Hide resolved
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
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.

lib/src/unicode_to_english.dart Outdated Show resolved Hide resolved
convertedString.add(fullStr);
} else if (splittedString[i] != '\u094D') {
convertedString
.add(_unicodeMap[splittedString[i]] ?? splittedString[i]);
Copy link
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

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
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 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
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.

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
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 on lines 37 to 38
_text = convertedString.join('');
return _text;
Copy link
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.

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

### Unicode to English iterals
Converts Nepali Unicode into English literals.
```dart
print(NepaliUnicode.convert("सयौं थुँगा फूलका हामी, एउटै माला नेपाली"));
Copy link
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
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