字符串翻译和Java代码问题

时间:2019-03-18 23:50:51

标签: java android

我请自由职业者为我制作一个应用程序,我是Java的初学者,但我知道一些基础知识。因此,当我尝试使用字符串文件设置翻译时。我看到此代码无法翻译。 我尝试了R.String ....,但是不起作用。 这是代码。

private void updateLabel() {
    int date_length = 272;
    date_length += spCycle.getSelectedItemPosition();
    String result = **"Based on a last menstrual period of "** + String.format("%1$tb %1$td, %1$tY", calendar) + **" and a "** + spCycle.getSelectedItem().toString() + " menstrual cycle :\n\n";
    calendar.add(Calendar.DAY_OF_MONTH, date_length);
    result += **"Your baby's estimated due date is on or around "** + String.format("%1$tA, %1$tb %1$td, %1$tY", calendar) + "\n\n";
    calendar.add(Calendar.DAY_OF_MONTH, 14 - date_length);
    result += **"Conception likely took place on "** + String.format("%1$tb %1$td, %1$tY", calendar) + ". \n\n";
    calendar.add(Calendar.DAY_OF_MONTH, -14);
    int diff = (int) ((System.currentTimeMillis() - calendar.getTimeInMillis()) / 3600000 / 24 + 1);
    result += diff + **" days have passed since the start of your pregnancy. There are "** + (date_length - diff) + **" days left until your due date."**;

0 个答案:

没有答案