forked from organicmaps/organicmaps
[strings] Move hardcoded strings to string resource file
The hardcoded strings from the user routes feature were moved into the default strings resource file. Translations to these strings were added for portuguese. Signed-off-by: Fábio Gomes <gabriel.gomes@tecnico.ulisboa.pt>
This commit is contained in:
parent
a241a68189
commit
3d059f6224
5 changed files with 61 additions and 16 deletions
|
@ -15,6 +15,7 @@ import android.widget.EditText;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
@ -103,9 +104,9 @@ public class MyRoutesFragment extends Fragment
|
|||
return;
|
||||
if (Framework.nativeHasSavedUserRoute(newRouteName))
|
||||
{
|
||||
showConfirmationDialog(newRouteName + " already exists",
|
||||
"Overwrite existing " + newRouteName + "?",
|
||||
"Overwrite");
|
||||
showConfirmationDialog(getString(R.string.user_route_overwrite_title, newRouteName),
|
||||
getString(R.string.user_route_overwrite_body, newRouteName),
|
||||
R.string.overwrite);
|
||||
return;
|
||||
}
|
||||
save(false);
|
||||
|
@ -148,9 +149,9 @@ public class MyRoutesFragment extends Fragment
|
|||
return;
|
||||
if (Framework.nativeHasSavedUserRoute(newRouteName))
|
||||
{
|
||||
showConfirmationDialog(newRouteName + " already exists",
|
||||
"Overwrite existing " + newRouteName + "?",
|
||||
"Overwrite");
|
||||
showConfirmationDialog(getString(R.string.user_route_overwrite_title, newRouteName),
|
||||
getString(R.string.user_route_overwrite_body, newRouteName),
|
||||
R.string.overwrite);
|
||||
return;
|
||||
}
|
||||
rename(false);
|
||||
|
@ -178,9 +179,9 @@ public class MyRoutesFragment extends Fragment
|
|||
{
|
||||
mDialogCaller = DELETE_ID;
|
||||
mCurrentItem = item;
|
||||
showConfirmationDialog("Delete " + item.getRouteName() + "?",
|
||||
"This action cannot be undone.",
|
||||
"Delete");
|
||||
showConfirmationDialog(getString(R.string.user_route_delete_title, item.getRouteName()),
|
||||
getString(R.string.user_route_delete_body),
|
||||
R.string.delete);
|
||||
}
|
||||
|
||||
private void delete()
|
||||
|
@ -197,7 +198,7 @@ public class MyRoutesFragment extends Fragment
|
|||
bottomSheet.dismiss();
|
||||
}
|
||||
|
||||
private void showConfirmationDialog(String title, String message, String buttonText)
|
||||
private void showConfirmationDialog(String title, String message, @StringRes int buttonText)
|
||||
{
|
||||
AlertDialog dialog = new AlertDialog.Builder(this.getContext(), R.style.MwmTheme_AlertDialog)
|
||||
.setTitle(title)
|
||||
|
@ -209,7 +210,7 @@ public class MyRoutesFragment extends Fragment
|
|||
case DELETE_ID -> delete();
|
||||
}
|
||||
})
|
||||
.setNegativeButton("Cancel", (dialogInterface, i) -> {
|
||||
.setNegativeButton(R.string.cancel, (dialogInterface, i) -> {
|
||||
switch (mDialogCaller) {
|
||||
case SAVE_ID, RENAME_ID -> retryInput();
|
||||
}
|
||||
|
@ -227,16 +228,16 @@ public class MyRoutesFragment extends Fragment
|
|||
input.setText(defaultText);
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(this.getContext(), R.style.MwmTheme_AlertDialog)
|
||||
.setTitle("Route Name")
|
||||
.setTitle(R.string.user_route_input_title)
|
||||
.setView(input)
|
||||
.setPositiveButton("OK", (dialogInterface, i) -> {
|
||||
.setPositiveButton(R.string.ok, (dialogInterface, i) -> {
|
||||
mEditText = input.getText().toString();
|
||||
switch (mDialogCaller) {
|
||||
case SAVE_ID -> checkSave();
|
||||
case RENAME_ID -> checkRename();
|
||||
}
|
||||
})
|
||||
.setNegativeButton("Cancel", null)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create();
|
||||
|
||||
dialog.show();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin_base"
|
||||
android:layout_marginTop="@dimen/margin_base"
|
||||
android:text="My Routes"
|
||||
android:text="@string/user_route_title"
|
||||
android:textAppearance="?fontHeadline6"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
@ -41,7 +41,7 @@
|
|||
android:id="@+id/save_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Save Current Route"
|
||||
android:text="@string/user_route_save"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="16dp"/>
|
||||
|
||||
|
|
|
@ -108,6 +108,18 @@
|
|||
<string name="measurement_units">Unidades de medida</string>
|
||||
<!-- Detailed description of Measurement Units settings button -->
|
||||
<string name="measurement_units_summary">Escolha entre milhas e quilômetros</string>
|
||||
<!-- Button text -->
|
||||
<string name="overwrite">Sobrescrever</string>
|
||||
<!-- Button text which saves user route -->
|
||||
<string name="user_route_save">Salvar rota atual</string>
|
||||
<!-- Title in the user routes fragment -->
|
||||
<string name="user_route_title">Minhas Rotas</string>
|
||||
<!-- Title in dialog to confirm user route deletion -->
|
||||
<string name="user_route_delete_title">Apagar %1$s?</string>
|
||||
<!-- Text in dialog to confirm user route deletion -->
|
||||
<string name="user_route_delete_body">Essa ação não pode ser desfeita.</string>
|
||||
<!-- Title in dialog to input the name of a user route -->
|
||||
<string name="user_route_input_title">Nome da rota</string>
|
||||
|
||||
<!-- SECTION: Search categories -->
|
||||
<!-- Search category for cafes, bars, restaurants; any changes should be duplicated in categories.txt @category_eat! -->
|
||||
|
|
|
@ -100,6 +100,22 @@
|
|||
<string name="measurement_units">Unidades de medida</string>
|
||||
<!-- Detailed description of Measurement Units settings button -->
|
||||
<string name="measurement_units_summary">Escolha entre milhas e quilómetros</string>
|
||||
<!-- Button text -->
|
||||
<string name="overwrite">Sobrescrever</string>
|
||||
<!-- Button text which saves user route -->
|
||||
<string name="user_route_save">Guardar rota atual</string>
|
||||
<!-- Title in the user routes fragment -->
|
||||
<string name="user_route_title">As Minhas Rotas</string>
|
||||
<!-- Title in dialog to confirm user route overwrite -->
|
||||
<string name="user_route_overwrite_title">%1$s já existe</string>
|
||||
<!-- Text in dialog to confirm user route overwrite -->
|
||||
<string name="user_route_overwrite_body">Sobrescrever %1$s existente?</string>
|
||||
<!-- Title in dialog to confirm user route deletion -->
|
||||
<string name="user_route_delete_title">Eliminar %1$s?</string>
|
||||
<!-- Text in dialog to confirm user route deletion -->
|
||||
<string name="user_route_delete_body">Esta ação não pode ser desfeita.</string>
|
||||
<!-- Title in dialog to input the name of a user route -->
|
||||
<string name="user_route_input_title">Nome da rota</string>
|
||||
|
||||
<!-- SECTION: Search categories -->
|
||||
<!-- Search category for cafes, bars, restaurants; any changes should be duplicated in categories.txt @category_eat! -->
|
||||
|
|
|
@ -115,6 +115,22 @@
|
|||
<string name="measurement_units">Measurement units</string>
|
||||
<!-- Detailed description of Measurement Units settings button -->
|
||||
<string name="measurement_units_summary">Choose between miles and kilometers</string>
|
||||
<!-- Button text -->
|
||||
<string name="overwrite">Overwrite</string>
|
||||
<!-- Button text which saves user route -->
|
||||
<string name="user_route_save">Save current route</string>
|
||||
<!-- Title in the user routes fragment -->
|
||||
<string name="user_route_title">My Routes</string>
|
||||
<!-- Title in dialog to confirm user route overwrite -->
|
||||
<string name="user_route_overwrite_title">%1$s already exists</string>
|
||||
<!-- Text in dialog to confirm user route overwrite -->
|
||||
<string name="user_route_overwrite_body">Overwrite existing %1$s?</string>
|
||||
<!-- Title in dialog to confirm user route deletion -->
|
||||
<string name="user_route_delete_title">Delete %1$s?</string>
|
||||
<!-- Text in dialog to confirm user route deletion -->
|
||||
<string name="user_route_delete_body">This action cannot be undone.</string>
|
||||
<!-- Title in dialog to input the name of a user route -->
|
||||
<string name="user_route_input_title">Route name</string>
|
||||
|
||||
<!-- SECTION: Search categories -->
|
||||
<!-- Search category for cafes, bars, restaurants; any changes should be duplicated in categories.txt @category_eat! -->
|
||||
|
|
Loading…
Add table
Reference in a new issue