Issue
I have a classic multi-language setup in my app with two 'values' folders: values
for default danish language and values-se
for swedish. My device is set to locale sw-SE
, but my app still shows string resources in danish (default).
If I move the danish resources to a folder values-da
(for danish) and create an empty folder values
, Then I get the error that the resource is not found. I this case if finds nither danish nor swedish strings.
Here is a typical call to a resource:
m_ButtonOk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String email = m_EditEmail.getText().toString();
String pass = m_EditPassword.getText().toString();
if (email.equals("") == false && pass.equals("") == false) {
//Save user info to Crashlytics
Crashlytics.setUserEmail(email);
showProgressDialog(getResources().getString(R.string.wait), getResources().getString(R.string.logging_on));
Intent logOnIntent = new Intent(v.getContext(), dk.le34.taskassistant.activity.TaskAssistantService.class);
logOnIntent.addCategory("dk.le34.taskassistant.LOG_ON");
logOnIntent.putExtra("EMAIL", email);
logOnIntent.putExtra("PASSWORD", pass);
logOnIntent.putExtra("REMEMBER", m_CheckBoxRemember.isChecked());
startService(logOnIntent);
} else {
Toast.makeText(v.getContext(), getResources().getString(R.string.user_details), Toast.LENGTH_LONG).show();
}
}
});
My setup is by the book, so why do I get these errors?
Solution
The locale for Swedish is "sv_SE". Your Swedish resources need to go into values-sv
, not values-se
.
"sv" is the language (in this case Swedish) "SE" is the country (in this case Sweden)
Answered By - David Wasser
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.