Skip to content

Commit

Permalink
Adapt to upstream translation scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
boricj committed Oct 28, 2017
1 parent 4e422a6 commit cde51fc
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 49 deletions.
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
ifneq (,$(findstring boricj.hello-world,${APPS_LIST}))
snapshots += Helloworld::App::Snapshot
snapshot_headers += apps/hello_world/app.h

app_objs += $(addprefix apps/boricj.hello-world/,\
app_objs += $(addprefix apps/hello_world/,\
app.o\
hello_controller.o\
hello_view.o\
)

app_images += apps/boricj.hello-world/helloworld_icon.png
i18n_files += $(addprefix apps/hello_world/,\
base.de.i18n\
base.en.i18n\
base.es.i18n\
base.fr.i18n\
base.pt.i18n\
)

endif
app_images += apps/hello_world/helloworld_icon.png
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ This is a sample third-party app for the NumWorks calculator.

## Getting started

Make sure you have the required third-party compile-time app support (https://github.com/numworks/epsilon/pull/73).
```
git clone https://github.com/boricj/numworks-hello-world.git apps/boricj.hello-world
make PLATFORM=simulator APPS_LIST="boricj.hello-world"
git clone https://github.com/boricj/numworks-hello-world.git apps/hello_world
make PLATFORM=simulator EPSILON_APPS='hello_world settings'
```
21 changes: 5 additions & 16 deletions app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,14 @@
#include "apps/i18n.h"
#include <assert.h>

namespace boricj {
namespace helloworld {
namespace Helloworld {

const I18n::StandardMessage HelloApp("Hello, World!", "Bonjour, Monde!");
const I18n::StandardMessage HelloAppCapital("Hello, World!", "Bonjour, Monde!");

const char * App::Descriptor::uriName() {
return "boricj.hello-world";
}

const I18n::Message *App::Descriptor::name() {
return &HelloApp;
I18n::Message App::Descriptor::name() {
return I18n::Message::HelloApp;
}

const I18n::Message *App::Descriptor::upperName() {
return &HelloAppCapital;
I18n::Message App::Descriptor::upperName() {
return I18n::Message::HelloAppCapital;
}

const Image * App::Descriptor::icon() {
Expand Down Expand Up @@ -48,7 +40,4 @@ App::App(Container * container, Snapshot * snapshot) :
{
}

static App::Snapshot::Register r(new App::Snapshot());

}
}
13 changes: 5 additions & 8 deletions app.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#ifndef BORICJ_HELLOWORLD_APP_H
#define BORICJ_HELLOWORLD_APP_H
#ifndef HELLOWORLD_APP_H
#define HELLOWORLD_APP_H

#include <escher.h>
#include "hello_controller.h"

namespace boricj {
namespace helloworld {
namespace Helloworld {

class App : public ::App {
public:
class Descriptor : public ::App::Descriptor {
public:
const char * uriName() override;
const I18n::Message *name() override;
const I18n::Message *upperName() override;
I18n::Message name() override;
I18n::Message upperName() override;
const Image * icon() override;
};
class Snapshot : public ::App::Snapshot {
Expand All @@ -28,7 +26,6 @@ class App : public ::App {
HelloController m_helloController;
};

}
}

#endif
2 changes: 2 additions & 0 deletions base.de.i18n
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HelloApp = "Hallo, Welt!"
HelloAppCapital = "HALLO WELT"
2 changes: 2 additions & 0 deletions base.en.i18n
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HelloApp = "Hello, World!"
HelloAppCapital = "HELLO WORLD"
2 changes: 2 additions & 0 deletions base.es.i18n
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HelloApp = "Hola, Mundo!"
HelloAppCapital = "HOLA MUNDO"
2 changes: 2 additions & 0 deletions base.fr.i18n
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HelloApp = "Bonjour, Monde!"
HelloAppCapital = "BONJOUR MONDE"
2 changes: 2 additions & 0 deletions base.pt.i18n
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HelloApp = "Ola, Mundo!"
HelloAppCapital = "OLA MUNDO"
5 changes: 1 addition & 4 deletions hello_controller.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#include "hello_controller.h"
#include "apps/i18n.h"
#include <assert.h>

namespace boricj {
namespace helloworld {
namespace Helloworld {

HelloController::HelloController(Responder * parentResponder) :
ViewController(parentResponder)
Expand All @@ -26,4 +24,3 @@ bool HelloController::handleEvent(Ion::Events::Event event) {
}

}
}
8 changes: 3 additions & 5 deletions hello_controller.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#ifndef BORICJ_HELLOWORLD_HELLO_CONTROLLER_H
#define BORICJ_HELLOWORLD_HELLO_CONTROLLER_H
#ifndef HELLOWORLD_HELLO_CONTROLLER_H
#define HELLOWORLD_HELLO_CONTROLLER_H

#include <escher.h>

#include "hello_view.h"

namespace boricj {
namespace helloworld {
namespace Helloworld {

class HelloController : public ViewController {
public:
Expand All @@ -18,7 +17,6 @@ class HelloController : public ViewController {
HelloView m_helloView;
};

}
}

#endif
8 changes: 4 additions & 4 deletions hello_view.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include "hello_view.h"

namespace boricj {
namespace helloworld {
#include "apps/i18n.h"

namespace Helloworld {

HelloView::HelloView() :
View(),
m_bufferTextView(KDText::FontSize::Large, 0.5, 0.5, KDColorBlack),
m_color(3),
m_kdcolor(Palette::GreyWhite)
{
m_bufferTextView.setText("Hello, World!");
m_bufferTextView.setText(I18n::translate(I18n::Message::HelloApp));
m_bufferTextView.setFrame(KDRect(0, 0, bounds().width(), bounds().height()));
}

Expand Down Expand Up @@ -58,4 +59,3 @@ void HelloView::layoutSubviews() {
}

}
}
8 changes: 3 additions & 5 deletions hello_view.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#ifndef BORICJ_HELLOWORLD_HELLOVIEW_H
#define BORICJ_HELLOWORLD_HELLOVIEW_H
#ifndef HELLOWORLD_HELLOVIEW_H
#define HELLOWORLD_HELLOVIEW_H

#include <escher.h>

namespace boricj {
namespace helloworld {
namespace Helloworld {

class HelloView : public View {
public:
Expand All @@ -21,7 +20,6 @@ class HelloView : public View {
KDColor m_kdcolor;
};

}
}

#endif

0 comments on commit cde51fc

Please sign in to comment.