summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik.ramaekers@protonmail.com>2020-03-20 13:58:59 +0100
committerAldrik Ramaekers <aldrik.ramaekers@protonmail.com>2020-03-20 13:58:59 +0100
commitcaa8755e8a8e46cbc1dd0a883ff5d0bdddb7e9a6 (patch)
tree5005798ace49feaf9f7ffd6e0a5eb589edfba51c /src
parent40ed604986f41cee55ce1a85ffe28e8238ae3894 (diff)
tooltip +translations
Diffstat (limited to 'src')
-rw-r--r--src/mo_edit.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/mo_edit.c b/src/mo_edit.c
index a3005c4..3f9cc2c 100644
--- a/src/mo_edit.c
+++ b/src/mo_edit.c
@@ -159,8 +159,7 @@ s32 add_language_to_project(char *buffer)
{
if (string_equals(buffer, ""))
{
- // TODO(Aldrik): localize
- platform_show_message(main_window, "Language name cannot be empty", "Invalid info");
+ platform_show_message(main_window, localize("language_name_cannot_be_empty"), localize("invalid_info"));
return -1;
}
@@ -169,8 +168,7 @@ s32 add_language_to_project(char *buffer)
language *lang = array_at(&current_project->languages, i);
if (string_equals(lang->name, buffer))
{
- // TODO(Aldrik): localize
- platform_show_message(main_window, "Language already added", "Invalid info");
+ platform_show_message(main_window, localize("language_already_added"), localize("invalid_info"));
return -1;
}
}
@@ -209,6 +207,16 @@ void set_term_name(s32 index, char *name)
{
if (strlen(name) > 0)
{
+ for (s32 i = 0; i < current_project->terms.length; i++)
+ {
+ term *t = array_at(&current_project->terms, i);
+ if (string_equals(t->name, name) && i != index)
+ {
+ platform_show_message(main_window, localize("term_already_added"), localize("invalid_info"));
+ return;
+ }
+ }
+
term *t = array_at(&current_project->terms, index);
string_copyn(t->name, name, MAX_TERM_NAME_LENGTH);
}
@@ -581,7 +589,7 @@ int main(int argc, char **argv)
}
// TODO(Aldrik): localize
calculate_recent_project_path_max_len();
- ui_begin_menu_submenu(&submenu_recent_projects, "Recent projects");
+ ui_begin_menu_submenu(&submenu_recent_projects, localize("recent_projects"));
{
for (s32 i = recent_projects_list.length-1; i >= 0; i--)
{
@@ -632,6 +640,7 @@ int main(int argc, char **argv)
{
current_project->selected_term_index = -1;
}
+ ui_push_tooltip(localize("tooltip_project_overview"));
ui_push_textf_width(font_medium, localize("terms"), global_ui_context.layout.width-106);
@@ -639,6 +648,7 @@ int main(int argc, char **argv)
{
select_term(add_term_to_project());
}
+ ui_push_tooltip(localize("tooltip_create_new_term"));
//ui_push_button_image(&btn_summary, "", delete_img);
@@ -674,6 +684,7 @@ int main(int argc, char **argv)
{
removed = true;
}
+ ui_push_tooltip(localize("tooltip_delete_term"));
//ui_push_image(exclaim_img, 14, 14, 1, rgb(255,255,255));
@@ -746,6 +757,7 @@ int main(int argc, char **argv)
{
save_term_changes();
}
+ ui_push_tooltip(localize("tooltip_save_term"));
}
ui_block_end();
@@ -849,6 +861,7 @@ int main(int argc, char **argv)
keyboard_set_input_text(&keyboard, "");
tb_new_language.state = true;
}
+ ui_push_tooltip(localize("tooltip_add_language"));
if (!string_equals(tb_new_language.buffer, ""))
{
@@ -883,6 +896,7 @@ int main(int argc, char **argv)
{
pressed = true;
}
+ ui_push_tooltip(localize("tooltip_delete_language"));
language *l = array_at(&current_project->languages, i);
ui_push_text_width(l->name, global_ui_context.layout.width-200, false);