Start using fmt library

This is the first step for a full i18n (#124).
This commit is contained in:
David Capello 2017-10-09 14:43:01 -03:00
parent aa95ccde80
commit f4ffd4110c
7 changed files with 40 additions and 6 deletions

3
.gitmodules vendored
View File

@ -57,3 +57,6 @@
[submodule "third_party/giflib"]
path = third_party/giflib
url = https://github.com/aseprite/giflib.git
[submodule "third_party/fmt"]
path = third_party/fmt
url = https://github.com/aseprite/fmt.git

View File

@ -230,6 +230,34 @@ be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.
```
# [fmt](https://github.com/fmtlib/fmt)
```
Copyright (c) 2012 - 2016, Victor Zverovich
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
# [FreeType](http://www.freetype.org/)
```

View File

@ -554,7 +554,8 @@ target_link_libraries(app-lib
${FREETYPE_LIBRARIES}
${HARFBUZZ_LIBRARIES}
json11
archive_static)
archive_static
fmt)
if(ENABLE_SCRIPTING)
target_link_libraries(app-lib script-lib)

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2016 David Capello
// Copyright (C) 2016-2017 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -29,8 +29,6 @@ namespace app {
std::unordered_map<std::string, std::string> m_strings;
};
#define tr(id) (Strings::instance()->translate(id))
} // namespace app
#endif

View File

@ -24,6 +24,7 @@
#include "app/ui_context.h"
#include "base/bind.h"
#include "base/exception.h"
#include "fmt/format.h"
#include "ui/label.h"
#include "ui/resize_event.h"
#include "ui/system.h"
@ -143,7 +144,7 @@ void HomeView::onCheckingUpdates()
void HomeView::onUpToDate()
{
checkUpdate()->setText(PACKAGE " is up to date");
checkUpdate()->setText(fmt::format("{0} is up to date", PACKAGE));
checkUpdate()->setVisible(true);
layout();
@ -151,7 +152,8 @@ void HomeView::onUpToDate()
void HomeView::onNewUpdate(const std::string& url, const std::string& version)
{
checkUpdate()->setText("New " PACKAGE " v" + version + " available!");
checkUpdate()->setText(fmt::format("New {0} v{1} available!",
PACKAGE, version));
checkUpdate()->setUrl(url);
checkUpdate()->setVisible(true);
checkUpdate()->InitTheme.connect(

View File

@ -88,6 +88,7 @@ endif()
add_subdirectory(harfbuzz-cmake)
add_subdirectory(simpleini)
add_subdirectory(fmt)
# Add cmark without tests
if(NOT USE_SHARED_CMARK)

1
third_party/fmt vendored Submodule

@ -0,0 +1 @@
Subproject commit 933a33a7948c3d9bb984473b9b92832f52c590cd