Skip to content

Commit ba41682

Browse files
committed
feat: Translate some remaining string in hindi language
1 parent 7030cab commit ba41682

File tree

6 files changed

+94
-52
lines changed

6 files changed

+94
-52
lines changed

app/src/main/java/android/code/editor/adapters/viewholders/FileTreeViewHolder.java

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class FileTreeViewHolder extends TreeNode.BaseNodeViewHolder<File> {
4848
public ImageView expandCollapse;
4949
public TextView path;
5050
public CodeEditorActivity editorActivity;
51+
public ViewFlipper viewFlipper;
5152

5253
public FileTreeViewHolder(Context context, CodeEditorActivity editorActivity) {
5354
super(context);
@@ -64,6 +65,7 @@ public View createNodeView(TreeNode node, File file) {
6465
icon = view.findViewById(R.id.icon);
6566
expandCollapse = view.findViewById(R.id.expandCollapse);
6667
path = view.findViewById(R.id.path);
68+
viewFlipper = view.findViewById(R.id.viewFlipper);
6769
FileIcon.setUpIcon(context, file.getAbsolutePath(), icon);
6870
if (file.isDirectory()) {
6971
expandCollapse.setVisibility(View.VISIBLE);
@@ -102,33 +104,7 @@ public void run() {
102104
}
103105
});
104106
} else {
105-
ExecutorService loadFiles = Executors.newSingleThreadExecutor();
106-
loadFiles.execute(
107-
new Runnable() {
108-
@Override
109-
public void run() {
110-
editorActivity.runOnUiThread(
111-
new Runnable() {
112-
@Override
113-
public void run() {
114-
((ViewFlipper) view.findViewById(R.id.viewFlipper))
115-
.setDisplayedChild(1);
116-
}
117-
});
118-
119-
listDirInNode(node, file);
120-
editorActivity.runOnUiThread(
121-
new Runnable() {
122-
@Override
123-
public void run() {
124-
getTreeView().expandNode(node);
125-
((ViewFlipper) view.findViewById(R.id.viewFlipper))
126-
.setDisplayedChild(0);
127-
updateExpandCollapseIcon(expandCollapse, node.isExpanded());
128-
}
129-
});
130-
}
131-
});
107+
expandNode(node, file);
132108
}
133109
}
134110
});
@@ -170,6 +146,45 @@ public void listDirInNode(TreeNode node, File file) {
170146
}
171147
}
172148

149+
public void expandNode(TreeNode node, File file) {
150+
ExecutorService loadFiles = Executors.newSingleThreadExecutor();
151+
loadFiles.execute(
152+
new Runnable() {
153+
@Override
154+
public void run() {
155+
editorActivity.runOnUiThread(
156+
new Runnable() {
157+
@Override
158+
public void run() {
159+
((ViewFlipper) view.findViewById(R.id.viewFlipper)).setDisplayedChild(1);
160+
}
161+
});
162+
163+
listDirInNode(node, file);
164+
165+
editorActivity.runOnUiThread(
166+
new Runnable() {
167+
@Override
168+
public void run() {
169+
getTreeView().expandNode(node);
170+
((ViewFlipper) view.findViewById(R.id.viewFlipper)).setDisplayedChild(0);
171+
updateExpandCollapseIcon(expandCollapse, node.isExpanded());
172+
if (node.getChildren().size() == 1) {
173+
expandNode(
174+
node.getChildren().get(0), (File) node.getChildren().get(0).getValue());
175+
((FileTreeViewHolder) node.getChildren().get(0).getViewHolder())
176+
.viewFlipper.setDisplayedChild(0);
177+
updateExpandCollapseIcon(
178+
((FileTreeViewHolder) node.getChildren().get(0).getViewHolder())
179+
.expandCollapse,
180+
node.getChildren().get(0).isExpanded());
181+
}
182+
}
183+
});
184+
}
185+
});
186+
}
187+
173188
final class FileComparator implements Comparator<File> {
174189
public int compare(File f1, File f2) {
175190
if (f1 == f2) return 0;

app/src/main/java/android/code/editor/utils/FileManagerActivity/FileCreatorDialog.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class FileCreatorDialog {
3636
public FileCreatorDialog(FileManagerActivity activity) {
3737
MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(activity);
3838
dialog.setTitle(R.string.create_new_file);
39-
dialog.setMessage(R.string.enter_file_name_to_create);
39+
dialog.setMessage(R.string.to_create_file_enter_name);
4040
ViewGroup nameCont =
4141
(LinearLayout)
4242
activity
@@ -63,7 +63,8 @@ public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
6363
} else if (new File(
6464
activity.currentDir.concat(File.separator).concat(path.getText().toString()))
6565
.exists()) {
66-
path.setError(activity.getString(R.string.please_enter_a_file_name_that_does_not_exists));
66+
path.setError(
67+
activity.getString(R.string.please_enter_a_file_name_that_does_not_exists));
6768
} else {
6869
path.setError(null);
6970
}
@@ -87,7 +88,9 @@ public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
8788
activity.currentDir.concat(File.separator).concat(path.getText().toString()))
8889
.exists()) {
8990
Toast.makeText(
90-
activity, R.string.please_enter_a_file_name_that_does_not_exists, Toast.LENGTH_SHORT)
91+
activity,
92+
R.string.please_enter_a_file_name_that_does_not_exists,
93+
Toast.LENGTH_SHORT)
9194
.show();
9295
} else if (!new File(
9396
activity.currentDir.concat(File.separator).concat(path.getText().toString()))

app/src/main/java/android/code/editor/utils/FileManagerActivity/FolderCreatorDialog.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
public class FolderCreatorDialog {
3434
public FolderCreatorDialog(FileManagerActivity activity) {
3535
MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(activity);
36-
dialog.setTitle("Create new folder");
37-
dialog.setMessage("Enter folder name to create");
36+
dialog.setTitle(R.string.create_new_folder);
37+
dialog.setMessage(R.string.to_create_folder_enter_name);
3838
ViewGroup nameCont =
3939
(LinearLayout)
4040
activity
@@ -43,7 +43,7 @@ public FolderCreatorDialog(FileManagerActivity activity) {
4343
EditText path = nameCont.findViewById(android.code.editor.R.id.edittext1);
4444
TextInputLayout textInputLayout =
4545
nameCont.findViewById(android.code.editor.R.id.TextInputLayout1);
46-
textInputLayout.setHint("Enter folder name");
46+
textInputLayout.setHint(R.string.enter_folder_name);
4747
path.addTextChangedListener(
4848
new TextWatcher() {
4949
@Override
@@ -52,11 +52,12 @@ public void afterTextChanged(Editable arg0) {}
5252
@Override
5353
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
5454
if (path.getText().length() == 0) {
55-
path.setError("Please enter a folder name");
55+
path.setError(activity.getString(R.string.please_enter_a_folder_name));
5656
} else if (new File(
5757
activity.currentDir.concat(File.separator).concat(path.getText().toString()))
5858
.exists()) {
59-
path.setError("Please enter a folder that does not exists");
59+
path.setError(
60+
activity.getString(R.string.please_enter_a_folder_name_that_does_not_exists));
6061
} else {
6162
path.setError(null);
6263
}
@@ -67,10 +68,11 @@ public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
6768
});
6869
dialog.setView(nameCont);
6970
dialog.setPositiveButton(
70-
"Create",
71+
R.string.create,
7172
(param0, param1) -> {
7273
if (path.getText().length() == 0) {
73-
Toast.makeText(activity, "Please enter a folder name", Toast.LENGTH_SHORT).show();
74+
Toast.makeText(activity, R.string.please_enter_a_folder_name, Toast.LENGTH_SHORT)
75+
.show();
7476
} else if (!new File(
7577
activity.currentDir.concat(File.separator).concat(path.getText().toString()))
7678
.exists()) {
@@ -81,7 +83,9 @@ public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
8183
activity.loadFileList(activity.currentDir);
8284
} else {
8385
Toast.makeText(
84-
activity, "Please enter a folder that does not exists", Toast.LENGTH_SHORT)
86+
activity,
87+
R.string.please_enter_a_folder_name_that_does_not_exists,
88+
Toast.LENGTH_SHORT)
8589
.show();
8690
}
8791
});

app/src/main/java/android/code/editor/utils/FileManagerActivity/ProjectCreatorDialog.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ public void init() {
7575
html_template.setOnClickListener(
7676
(view) -> {
7777
MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(context);
78-
dialog.setTitle("Create new project");
79-
dialog.setMessage("Enter project name to create");
78+
dialog.setTitle(R.string.create_new_project);
79+
dialog.setMessage(R.string.to_create_project_enter_name);
8080
ViewGroup nameCont =
8181
((LinearLayout)
8282
((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
8383
.inflate(android.code.editor.R.layout.layout_edittext_dialog, null));
8484
EditText path = nameCont.findViewById(android.code.editor.R.id.edittext1);
8585
TextInputLayout textInputLayout =
8686
nameCont.findViewById(android.code.editor.R.id.TextInputLayout1);
87-
textInputLayout.setHint("Enter folder name");
87+
textInputLayout.setHint(R.string.enter_project_name);
8888
path.addTextChangedListener(
8989
new TextWatcher() {
9090
@Override
@@ -93,13 +93,13 @@ public void afterTextChanged(Editable arg0) {}
9393
@Override
9494
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
9595
if (path.getText().length() == 0) {
96-
path.setError("Please enter a project name");
96+
path.setError(context.getString(R.string.please_enter_a_project_name));
9797
} else if (new File(
9898
filePath.concat(File.separator).concat(path.getText().toString()))
9999
.exists()) {
100-
path.setError("Please enter a project that does not exists");
100+
path.setError(context.getString(R.string.please_enter_a_file_name_that_does_not_exists));
101101
} else if (path.getText().toString().contains("/")) {
102-
path.setError("Please do not enter / in project name");
102+
path.setError(context.getString(R.string.please_do_not_enter_slash_in_project_name));
103103
} else {
104104
path.setError(null);
105105
}
@@ -110,17 +110,17 @@ public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
110110
});
111111
dialog.setView(nameCont);
112112
dialog.setPositiveButton(
113-
"Create",
113+
R.string.create,
114114
(param0, param1) -> {
115115
if (path.getText().length() == 0) {
116-
Toast.makeText(context, "Please enter a project name", Toast.LENGTH_SHORT).show();
116+
Toast.makeText(context, R.string.please_enter_a_project_name, Toast.LENGTH_SHORT).show();
117117
} else if (new File(
118118
filePath.concat(File.separator).concat(path.getText().toString()))
119119
.exists()) {
120-
Toast.makeText(context, "File path already exists", Toast.LENGTH_SHORT).show();
120+
Toast.makeText(context, R.string.please_enter_a_file_name_that_does_not_exists, Toast.LENGTH_SHORT).show();
121121
} else if (path.getText().toString().contains("/")) {
122122
Toast.makeText(
123-
context, "Please do not enter / in project name", Toast.LENGTH_LONG)
123+
context, R.string.please_do_not_enter_slash_in_project_name, Toast.LENGTH_LONG)
124124
.show();
125125
} else {
126126
_save_assets_folder(
@@ -135,7 +135,7 @@ public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
135135
}
136136
});
137137
dialog.setNegativeButton(
138-
"Cancel",
138+
R.string.cancel,
139139
(param0, param1) -> {
140140
dialog.create().dismiss();
141141
});

app/src/main/res/values-hi/strings.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,29 @@
1818
<string name="close_this">इसे बंद करें</string>
1919
<string name="create">बनाएं</string>
2020
<string name="create_new_file">नई फ़ाइल बनाएँ</string>
21+
<string name="create_new_folder">नया फ़ोल्डर बनाएं</string>
22+
<string name="create_new_project">नया फ़ोल्डर बनाएं</string>
2123
<string name="code_editor">कोड संपादक</string>
2224
<string name="console_log">कंसोल लॉग</string>
2325
<string name="editor">संपादक</string>
2426
<string name="enter_file_name">फ़ाइल नाम दर्ज करें</string>
25-
<string name="enter_file_name_to_create">बनाने के लिए फ़ाइल नाम दर्ज करें</string>
27+
<string name="enter_folder_name">फ़ोल्डर नाम दर्ज करें</string>
28+
<string name="enter_project_name">परियोजना नाम दर्ज करें</string>
2629
<string name="execute">अमल में लाना</string>
2730
<string name="general">सामान्य</string>
2831
<string name="language">भाषा</string>
2932
<string name="more">अधिक</string>
3033
<string name="new_file">नई फ़ाइल</string>
3134
<string name="new_folder">नया फ़ोल्डर</string>
32-
<string name="new_project">नया काम</string>
35+
<string name="new_project">नई परियोजना</string>
3336
<string name="open_file_fist_from_drawer">दराज से फ़ाइल सूची खोलें</string>
3437
<string name="open_source_licenses">ओपन सोर्स लाइसेंस</string>
38+
<string name="please_do_not_enter_slash_in_project_name">कृपया प्रोजेक्ट नाम में "/" दर्ज न करें</string>
3539
<string name="please_enter_a_file_name">कृपया एक फ़ाइल नाम दर्ज करें</string>
3640
<string name="please_enter_a_file_name_that_does_not_exists">कृपया वह फ़ाइल नाम दर्ज करें जो मौजूद नहीं है</string>
41+
<string name="please_enter_a_folder_name">कृपया एक फ़ोल्डर नाम दर्ज करें</string>
42+
<string name="please_enter_a_folder_name_that_does_not_exists">कृपया वह फ़ोल्डर नाम दर्ज करें जो मौजूद नहीं है</string>
43+
<string name="please_enter_a_project_name">कृपया एक प्रोजेक्ट नाम दर्ज करें</string>
3744
<string name="please_enter_a_valid_name">कृपया एक मान्य नाम दर्ज करें</string>
3845
<string name="please_wait">कृपया प्रतीक्षा करें...</string>
3946
<string name="preview">पूर्व दर्शन</string>
@@ -42,6 +49,9 @@
4249
<string name="settings">समायोजन</string>
4350
<string name="sora_editor_theme">सोरा संपादक थीम</string>
4451
<string name="tap_to_start">शरू करने के लिए टैप करें</string>
52+
<string name="to_create_file_enter_name">फ़ाइल बनाने के लिए नाम दर्ज करें</string>
53+
<string name="to_create_folder_enter_name">फ़ोल्डर बनाने के लिए नाम दर्ज करें</string>
54+
<string name="to_create_project_enter_name">परियोजना बनाने के लिए नाम दर्ज करें</string>
4555
<string name="ui_mode">यूआई मोड</string>
4656
<string name="webview">वेब-दृश्य</string>
4757
</resources>

app/src/main/res/values/strings.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
<string name="close_this">Close this</string>
1919
<string name="create">Cancel</string>
2020
<string name="create_new_file">Create new file</string>
21+
<string name="create_new_folder">Create new folder</string>
22+
<string name="create_new_project">Create new project</string>
2123
<string name="code_editor">Code Editor</string>
2224
<string name="console_log">Console log</string>
2325
<string name="editor">Editor</string>
2426
<string name="enter_file_name">Enter file name</string>
25-
<string name="enter_file_name_to_create">Enter file name to create</string>
27+
<string name="enter_folder_name">Enter folder name</string>
28+
<string name="enter_project_name">Enter project name</string>
2629
<string name="execute">Execute</string>
2730
<string name="general">General</string>
2831
<string name="language">Language</string>
@@ -32,8 +35,12 @@
3235
<string name="new_project">New Project</string>
3336
<string name="open_file_fist_from_drawer">Open file list from drawer</string>
3437
<string name="open_source_licenses">Open Source Licenses</string>
38+
<string name="please_do_not_enter_slash_in_project_name">Please do not enter "/" in project name</string>
3539
<string name="please_enter_a_file_name">Please enter a file name</string>
3640
<string name="please_enter_a_file_name_that_does_not_exists">Please enter a file name that does not exists</string>
41+
<string name="please_enter_a_folder_name">Please enter a folder name</string>
42+
<string name="please_enter_a_folder_name_that_does_not_exists">Please enter a folder name that does not exists</string>
43+
<string name="please_enter_a_project_name">Please enter a project name</string>
3744
<string name="please_enter_a_valid_name">Please enter a valid name</string>
3845
<string name="please_wait">Please wait...</string>
3946
<string name="preview">Preview</string>
@@ -42,6 +49,9 @@
4249
<string name="settings">Settings</string>
4350
<string name="sora_editor_theme">Sora Editor Theme</string>
4451
<string name="tap_to_start">Tap to start</string>
52+
<string name="to_create_file_enter_name">To create file enter name</string>
53+
<string name="to_create_folder_enter_name">To create folder enter name</string>
54+
<string name="to_create_project_enter_name">To create project enter name</string>
4555
<string name="ui_mode">UI mode</string>
4656
<string name="webview">WebView</string>
4757
</resources>

0 commit comments

Comments
 (0)