GNU/Linux上程序的国际化和本地化(I18N & I10N)

python 64式: 第24式、python项目国际化翻译实战 1 寻找一个项目 进入一个python项目,这里我用的是之前写的项目myproject 2 步骤 2.1 在项目的目录下编写i18n.py文件 例如我的路径是: myproject/myproject目录下面 内容如下: # -*- encoding: utf-8 -*- import oslo_i18n # ref: https://docs.openstack.org/oslo.i18... 阅读详情
[目录 ]
0. forward
1. i18n and l10n introduction
2. gettext and intltool introduction
3. building a i18n program step by step
4. using autotools + intltool
 
[正文 ]
  1. froward
软件编写和文档通常使用英文,这便于世界各地的 程序员交流,但是并非所有用户都懂英文,所以程序能显示为用户的母语,能使软件用户群更大,且方便了普通用户。
过去我们讲“汉化”,在有了“ Internationalization(国际化 )”和“ localization(本地化 )”的概念和技术之后,“汉化”这个词要进入博物馆了  :-)
本文介绍 GNU工程中重要的工具 gettext和 intltool
  1. i18n and l10n introduction
首先介绍两个术语 I18N和 L10N,经常也写成小写 i18n和 l10n
I18N/L10N 是什么?
开发人员把 internationalization简写成 I18N,中间的数字 18是前后两个字母 i和 n之间的字母个数。  L10N依据“ localization”使用同样的命名规则。  I18N/L10N方法、协议和应用结合在一起,允许用户使用他们自己所选择的语言。
I18N应用程序使用 I18N工具来编程。它允许开发人员写一个简单的文件,就可以将显示的菜单和文本翻译成本地语言。我们非常鼓励程序员遵循这种规则。
为什么要使用 I18N/L10N?
I18N/L10N标准能够很好地支持您查看、输入或处理非英语语言。
I18N支持哪些语言?
I18N和 L10N不是 Linux特有的。当前,它能支持世界上绝大部分主力语言,包括但不限于:中文,德文,日文,朝鲜文,法文,俄文,越南文等等。
本地化设置需要具备三个条件:
  1. a. 语言 代码  (Language Code)
    b. 国家代码  (Country Code)
    c. 编码 (Encoding)
  • 本地名字可以用下面这些部分来构造:
    语言代码 _国家代码 .编码 比如( zh_CN.UTF-8, en_US等)
locale的别名表见  /usr/lib/X11/locale/locale.alias(以Debian GNU/Linux为例)
  1. gettext and intltool introduction and l10nize this program by gettext manually with autotool
gettext 是 GNU Translation Project上的重要一步,从它基础上可以构建其他步骤。 gettext提供了一个帮助产生多语言 message的框架:包括一组关于程序改如何编写以支持 message种类的约定, message种类相关的一个目录和文件命名组织,一个支持获取已翻译 message的运行时库,一些独立的程序(可以在终端运行如下命令查看  dpkg -L gettext | grep "/usr/bin/" | cut -d'/' -f4)。
intltool包含一些方便的命令,可以通过 dpkg -L intltool | grep “/usr/bin/” | cut -d'/' -f4查看。
  1. building a i18n program step by step
描述:编写一个提供 zh_CN 支持的程序。
 
步骤:
1)  编写文件  hello.c
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#define _(STRING) gettext(STRING)
#define PACKAGE_NAME "hello"
#define PACKAGE_VERSION "0.1.0"
// NOTE: PACKAGE_NAME.mo resides in ${LOCALEDIR}/zh_CN/LC_MESSAGES/
#define LOCALEDIR "./"
int main()
{
setlocale(LC_ALL, ""); // comes from locale.h
 
bindtextdomain(PACKAGE_NAME, LOCALEDIR); // comes from <libintl.h>
 
textdomain(PACKAGE_NAME); // comes from <libintl.h>
 
printf( _("Hello, World!/n") );
// printf(“Thanks!/n”);
return 0;
}
  1. 1.1 )编译  $gcc -o hello hello.c
运行 $ ./hello
Hello, World!
  1. 2 )提取翻译字符串
$xgettext -d hello –k_ -s -o hello.pot hello.c
-d 表示 domain
-s  表示排序
-k_ 指导 xgettext 搜寻可翻译字符串(前导下划线_),同事仍然搜索默认的 gettext 和 gettext_noop
上面的命令产生文件 hello.pot
3 )产生 zh_CN.po
方法一 :
$cp hello.pot zh_CN.po  ,然后修改 zh_CN.po 里面的内容。方法见 参考 a.
方法二:
$ msginit -l zh_CN -o zh_CN.po -i hello.pot, 然后翻译其中的字符为中文。保存为 UTF-8 编码。
4 )编译为二进制格式
$ msgfmt -c -v -o hello.mo zh_CN.po

5) $mkdir -p zh_CN/LC_MESSAGES
   $cp hello.mo zh_CN/LC_MESSAGES

6) 运行
$./hello
嗨,你好世界!
$LANG=C;./hello
Hello, World!

7)升级.po
在程序中添加一行printf( _(“Thanks!/n”) );
$gcc -o hello hello.c
$xgettext -d hello -k_ -s -o hello-new.pot hello.c #多个.c可以使用*.c或依此列出来
$msgmerge -s -U zh_CN.po hello-new.pot
$msgfmt -c -v -o hello.mo zh_CN.po #翻译保存,拷贝到zh_CN/LC_MESSAGES/

完毕。

另外
    a.如果使用Makefile,可以自己去写
    b.如何与autotools结合使用编写gtk+/gnome的gettext的例子
       [http://www-128.ibm.com/developerworks/cn/linux/l-gtk/part2/]

4. 通常我们使用更高层的脚本来实现gettext完成的事情,intltool就是这样的工具。
这里有一个入门文挡,来自intltool软件包,很简单。关于automake和autoconf我会在另外一篇blog中详细提到。
---------------
 
 
intltool README
http://intltool.freedesktop.org
 
The intltool collection can be used to do these things:
 
 o Extract translatable strings from various source files (.xml.in, .glade, .desktop.in, .server.in, .oaf.in).
 
 o Collect the extracted strings together with messages from traditional source files (.c, .h) in po/$(PACKAGE).pot.
 
 o Merge back the translations from .po files into .xml, .desktop and  .oaf files. This merge step will happen at build resp. installation time.
 
The intltool package has a script, intltoolize, which copies the various scripts and does the other magic to your module. So users building from tarballs don't need intltool, only folks building from cvs.
(This is modelled on gettextize.)
 
How to Use with autoconf/automake
---------------------------------
(There is a section for non-auto* configurations below)
To use intltool in your module, do the following:
 o Install intltool, and make sure that the macro it installs is in aclocal's path, or do:
 
    export ACLOCAL_FLAGS='-I /usr/local/share/aclocal'
 
 o Add these lines to autogen.sh, after the call to gettextize:
 
    echo "Running intltoolize"
    intltoolize --copy --force --automake
 
 o Add this line to configure.in near the top
 
    AC_PROG_INTLTOOL([minimum required version], [no-xml])
 
 o Add intltool-extract.in, intltool-merge.in, and intltool-update.in to EXTRA_DIST in your top-level Makefile.am and also to the top-level .cvsignore. Also add the non-.in versions to .cvsignore. 
 
 o Remove po/desk.pl and po/update.* scripts. intltool-update will take over their functionality.
 
At this point, translatable strings will be automatically extracted to the .po files, if you make use of the following recommendations.
 
The intltool-prepare script will help you to prepare the package. It will try to extract translations from existing .desktop files which will become obsolete after intltoolization has taken place.
 
Examples of packages that use intltool are listed in the USED file.
 
Details of the AC_PROG_INTLTOOL macro
-------------------------------------------
 
The first parameter indicates the minimum required version. The configure script will halt if the version is older than the first parameter.
 
The second parameter is to tell intltool that we don't need the extended xml parsing abilities provided by the XML::Parser perl module. If it is not provided, or is any value other than "no-xml", then XML::Parser will be checked for by the configure script. This feature is only available in intltool 0.31 or newer.
 
Extra Steps for DESKTOP Files
..............................
 
This step also applies for similar files (.directory, .soundlist).
 
 o Try to run intltool-prepare.
 
 o Make sure intltool-prepare did find existing translations in the old .desktop files and did correctly merge them into the various po/*.po files. Don't forget to commit the changed .po files; otherwise exiting translations will get lost!
 
 o Remove old .desktop files and add new .desktop.in files.
 
 o Adjust .cvsignore
 
 o Adjust Makefile.am, e.g.:
 
    --- start ----
 
        utilsdir = $(datadir)/gnome/apps/Utilities
        utils_in_files = bug-buddy.desktop.in
        utils_DATA = $(utils_in_files:.desktop.in=.desktop)
        @INTLTOOL_DESKTOP_RULE@
 
    --- end ----
 
 o Add .desktop.in files to po/POTFILES.in
 
Here's a .desktop.in example:
 
    --- start ----
 
        [Desktop Entry]
        _Name=Bug Report Tool
        _Comment=Report a bug in GNOME
        Exec=bug-buddy
        Icon=bug-buddy.png
        Terminal=0
        Type=Application
 
    --- end ----
 
Extra Steps for GLADE Files
...........................
 
 o Add the .glade files you want translated to POTFILES.in
 
 o Remove the intermediate *-glade.h or strings-glade.c files and drop them from POTFILES.in
 
 
Extra Steps for SERVER Files (formerly .oafinfo or .oaf)
.............................
 
To get server translation extraction and merging requires a few more steps:
 
 o Rename your .oafinfo (or .oaf) files to .oaf.in or .server.in and put an underscore before every value property for string attributes that should be localized.
 
 o Add the new .oaf.in or .server.in files to POTFILES.in.
 
 o Put lines like these in every Makefile.am that installs oaf files:
 
    --- start ----
 
    oafdir = $(datadir)/oaf
 
    oaf_in_files = My_OAF_info_file.oaf.in
    oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
 
    @INTLTOOL_OAF_RULE@
 
    EXTRA_DIST=$(oaf_in_files) $(oaf_DATA)
 
    --- end ----
 
At this point, your oaf translations will be extracted and merged. Also, so long as you are renaming the .oafinfo files to .oaf.in, you should take the opportunity to rename them to the new base naming convention, with namespacing, for example:
 
    foo.oafinfo --> GNOME_Foo.oaf.in
    foo-baa.oafinfo --> GNOME_Foo_baa.oaf.in
 
 
Extra Steps for XML Files (Files with .xml Extension)
.....................................................
 
To get xml (files with .xml extension) translation extraction and merging requires these steps:
 
 o Rename your .xml files to .xml.in and put an underscore before every element that should be localized.
 
 o Add the .xml.in files to POTFILES.in.
 
 o Put lines like these in every Makefile.am that installs xml files:
 
        --- start ----
 
        xmldir = $(datadir)/xml
 
        xml_in_files = My_xml_file.xml.in
        xml_DATA = $(xml_in_files:.xml.in=.xml)
 
        @INTLTOOL_XML_RULE@
 
        EXTRA_DIST=$(xml_in_files) $(xml_DATA)
 
        --- end ----
 
At this point, your xml translations will be extracted and merged. All .po files will be converted on the fly to UTF-8, and the resulting XML file will have a UTF-8 effective encoding (you should make sure that the encoding="..." declaration in the .xml.in file is either absent or actually specifies UTF-8).
 
Previous versions of intltool generated XML files whose contents were made of the contents of the .po files, without paying attention to the encodings used. A single "XML" file could thus have strings in different encodings. This broken behavior can be requested only by using the old xml-i18n-tools API instead of the intltool one. See old versions of xml-i18n-tools for documentation on how the old API worked.
 
---
 
XXX: add section for KEYS files. Works almost like XML files .
 
How to use without autoconf/automake
------------------------------------
 
intltool can also be used without the auto* tools. For instance in order to translate a somename.desktop.in file, you can do the following.
 
 o Create a po/ dir.
 o Add a po/POTFILES.in file, including the path to the somename.desktop.in file
 
Then to create the somename.desktop file all you do is:
 
$ intltool-merge po/ -d -u -c po/.intltool-merge-cache somename.desktop.in somename.desktop
 
You can also type intltool-merge --help for a bit more info.
 
To specify parameters for intltool-update (such as keywords or gettext domain), you can use Makevars syntax as used in recent GNU gettext, by putting something like the following in po/Makevars file:
 
 DOMAIN = mydomain
 XGETTEXT_OPTIONS = --keyword --keyword=blah
 
This will make "intltool-update -p" produce mydomain.pot, passing parameters "--keyword --keyword=blah" to xgettext when extracting strings.
 
Passing special parameters to xgettext via environment
......................................................
 
If you need to add parameters passed to xgettext on a case-by-case basis, you can do so using environment variable XGETTEXT_ARGS.
 
If you would run it as follows:
 
    XGETTEXT_ARGS=--no-location intltool-update -p
 
You would create a PO Template file without lines which indicate location of messages in the source code.
 
 
Changing keywords used in xgettext invocation
.............................................
 
If you need to change default keywords used to extract messages from source code, you need to add variable XGETTEXT_KEYWORDS to Makefile.in.in file inside directory where intltool-update is run from, eg.
 
        --- start ----
 
        XGETTEXT_KEYWORDS = --keyword --keyword=P_
 
        --- end ----
 
Default keywords xgettext looks for if no XGETTEXT_KEYWORDS is defined are _, N_ and U_.
 
 
Translators' comments in XML and .schemas files
...............................................
 
To provide comments to translators in free-form XML or .schema files, you need to precede the string to be translated with the plain XML comment. If comments contain character ">", they will be ignored (this is implementation issue, should be fixed in the future).
 
In .schemas files, comments need to be inside <default>, <short> or <long> elements (i.e. they cannot be before the opening tag).
 
 
这个文挡一步步地讲得很清楚,可以照着试验一下。
Autoconf/I18n-ify HelloWorld HOW-TO
 
In this article we are going to explain how to turn a simple Hello World application with a standard Makefile into an autotools-and I18N-enabled tree up to the point where it can be distributed.
 
Our existing helloworld.c file looks like the following:
 
#include <stdio.h>
 
int main (void) {
 printf ("Hello, world!/n");
}
 
1. First we create a source tree :
   /                        - This is the top level directory
   /src/                    - Here the source will end up.
 
   and place the helloworld.c file in the src/ dir
 
2. If your program has not been autoconf-enabled yet, you can create configure.scan (which is a good starting point for configure.ac) and rename it to configure.ac
 
    autoscan   # creates configure.scan
    mv configure.scan configure.ac
 
   Now edit configure.ac and make some changes. You can remove everything after AC_INIT, we'll be using AM_INIT_AUTOMAKE to pass on variables.
 
   Add the lines
     PACKAGE=helloworld
     VERSION=0.0.1
     AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
   to configure.in, just after AC_INIT
 
   Change AC_CONFIG_HEADER to AM_CONFIG_HEADER as well.
 
   If you have an empty AC_CONFIG_FILES macro, then comment that, or automake    will fail in the next step.
 
   Finally, add Makefile to the AC_OUTPUT macro by changing that line to read
     AC_OUTPUT(Makefile)
 
   NOTE: configure.ac used to be called configure.in
 
3. We add some files that automake does not make but are necessary to adhere to GNU standards.
 
     touch NEWS README AUTHORS ChangeLog
 
   These two files need to be created to satisfy automake
 
    touch config.h.in Makefile.am
 
   We will create Makefile.am later on.
 
4. To add some basic files (like COPYING, INSTALL, etc..)
   we run automake in the toplevel directory.
 
    automake --add-missing --gnu
 
5. After that we do the big i18n trick :-), also in the toplevel directory.
 
   gettextize --force --copy    # created po/ dir with some files
   intltoolize                 # bring in the perl helper scripts
 
6. Run autoheader which will create config.h.in
 
    autoheader # create config.h.in
 
7. Now, open up configure.in and make some modifications.
 
    The gettext macros need to be added after the initial checks. Putting them after the checks for library functions is a good idea.
 
    AC_PROG_INTLTOOL(0.26)
    AM_GNU_GETTEXT([external])
    ALL_LINGUAS="da nl"                 # Internationalization, means there is
                    # a .po file for danish and dutch.
    AM_GLIB_GNU_GETTEXT
 
    AC_OUTPUT(
    Makefile
    src/Makefile
    intl/Makefile
    po/Makefile.in
    )
 
    AC_PROG_INTLTOOL checks if a good enough intltool is available. Please require the latest intltool that exists. Intltool releases are pretty stable and often only contains bugfixes.
 
    AM_GNU_GETTEXT adds native language support to automake, together with a compile option.
 
    AM_GNU_GETTEXT will check for additional required functions and programs and will finally create po/POTFILES during configure.
 
    Instead of using AM_GLIB_GNU_GETTEXT you can do the following:
 
    [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile]
 
    The text domain is identified by PACKAGE. We will need to add a few functions later on to helloworld.c that will use this #define'd variable.
 
    Also, this will be the base filename for all your translation files, so make sure you choose a unique one.
 
8.
    Now add the add the supported languages to po/LINGUAS:
 
    da nl
 
    NOTE: These used to be in configure.{in,ac} in the ALL_LINGUAS variable. This is deprecated since gettext 0.11
 
9. Run
       aclocal
     to make sure that the necessary autoconf and automake macros are inserted in aclocal.m4
 
     Run
       autoconf
     to create the configure script.
 
10. install the gettext.h file (since gettext 0.11) and include it:
 
    #include "gettext.h"
    #define _(String) gettext (String)
 
11. Now add the following to helloworld.c
 
    #include <locale.h>
    #include "gettext.h"
    #define _(String) gettext (String)
    /* includes used by original program here */   
 
    int main (void)
    {
 
        setlocale (LC_ALL, "");
            bindtextdomain (PACKAGE, LOCALEDIR);
            textdomain (PACKAGE);
 
            /* Original Helloworld code here */
    }
 
    If you use GNOME og GTK+ the setlocale sentence shouldn't be needed
 
    We also substitute all strings we want to be translated with _("original string") to make sure that gettext is run on the strings. So the printf now looks like
 
      printf (_("Hello, world!/n"));
 
12. We create src/Makefile.am (from which Makefile.in and Makefile will be generated)
 
    INCLUDES = -I$(top_srcdir) -I$(includedir) /
               -DLOCALEDIR=/""$(datadir)/locale"/"
 
    bin_PROGRAMS = helloworld
 
    helloworld_SOURCES = helloworld.c
    noinst_HEADERS = i18n-support.h
 
13. Now we create the following toplevel Makefile.am
 
     SUBDIRS = src po
 
     EXTRA_DIST = intltool-extract.in intltool-merge.in intltool-update.in
 
14. Go into the directory po/ and create POTFILES.in
    This file should contain a list of all the files in your distribution (starting from the top, one level above the po dir) that contain strings to be internationalized.
 
    For the helloworld sample, it would contain
    src/helloworld.c
 
    Run
      intltool-update --pot
 
    Run
      intltool-update --maintain
    to see if you are missing files that contain marked strings. You should consider adding these to POTFILES.in
 
15. Now we start making a Danish and Dutch translation
 
    msginit --locale=da
    msginit --locale=nl
 
    intltool-update da
    intltool-update nl
 
    edit and update da.po and nl.po (The respective translations are "Hej verden" and "Hallo wereld")
16. Now we can compile. We will test it later, so we will install it in
    a temporary location.
    Close your eyes and type
      ./configure --prefix=/tmp/helloworld && make
    in the toplevel directory. :-)
17. To test if it works, you have to install the package.
    Run
      make install
    in the toplevel directory.
18. Now set the environment variable LC_ALL to your preferred language :
      export LC_ALL=nl_NL
      /tmp/helloworld/bin/helloworld
      export LC_ALL=da_DK
      /tmp/helloworld/bin/helloworld
 
    And if all goes well, the string should be translated in the two languages.
19. To finish it all up, run
      make dist
    to create a distributable tarball containing your internationalized program.
20. Exercises :
    - add another language
---------------
[参考 ]
a.  翻译 .po 流程  - http://i18n.linux.net.cn/method.php
b.  于明俭  - Linux  国际化本地化和中文化
The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition (Chap.7 Locale)
c. Internationalising GNOME applications (http://www.gnome.org/~malcolm/i18n/)
python 使用 xgettext 与 locale 做国家化与本土化的示例 简介 python 国家化与本土化的示例。起因是一款软件没有做语言的适配。 python的国际化gettext模块。mattkang 。2017-12-08 中对 i18n 和 l10n 说的特别到位的地方 国际化的软件具备这样一种能力,当软件被移植到不同的语言及地区时,软件本身不用做内部工程上的改变或修正。 相关词汇 Internationalization (i18n) - 国际化 Localization (l10n) - 本地化、本土化 怎么做 遇事不觉看文档 国际化 - Python docs 阅读详情

相关推荐

intltoolize --copy --force --automake ./autogen.sh: line 75: intltoolize: command not found

的问题,并继续你的安装过程。如果还有其他问题或者这些步骤没有解决问题,请提供更多信息,我将继续帮助你。包的一部分,这个包通常用于支持软件的国际化。通过这些步骤,你应该能够解决。命令在你的系统上未找到。

weixin_39291964的博客 699

Automake使用(高级)

工程地址 automake语言国际化 最初工程目录结构 $ ls -l total 16 drwxrwxr-x. 2 fedora fedora 4096 May 10 10:38 build-aux drwxrwxr-x. 2 fedora fedora 4096 May 10 10:38 m4 drwxrwxr-x. 2 fedora fedora 4096 May 10 10:38...

dcldz5007的博客 260

从仿真曲线到电路状态:用Cadence Virtuoso深度剖析CS放大器各个工作区(以电流源负载为例)

本文通过Cadence Virtuoso平台,深入剖析电流源负载CS放大器在不同工作区的表现,从仿真曲线解读电路状态。详细介绍了如何通过Vout-Vin直流扫描曲线判断MOS管工作区域(截止区、饱和区、线性区),并验证理论与仿真的一致性,提升模拟IC设计调试效率。

weixin_30940783的博客 446

GNU gettext工具简介

一、简介 支持多语言的程序,在编写时,通常源代码中的交互语句首先还是用英文编写,然后才为交互语句添加多语言支持机制。程序在运行过程时,再根据用户环境变量设置,选择合适的语言版本,显示给用户。 GNU gettext 为程序的国际化i18n和本地化l10n提供了很好的支持。 用GNU gettext实现多语言支持的一般步骤如下: 在程序源代码中添加gettext的相关声明信息及本地化运行环境检测代...

haiiiiiyun的博客 7507

C# emgu.cv图像识别 从大图中寻找小图,判断存在图的相似度

这是2个问题,我采用emgu.cv来解决这个识别问题,这里需要在nuget中引用emgu。最近写了一个在一张图片中,截取一部分,通过机器判断截取图片是这张图片的。第一、通过小图去找判断是否存在大图中,第二、小图存在大图的什么位置。

一个专注于技术研究创新的程序员 2469

微信小程序PC端数据抓取实战:用Fiddler Everywhere + OkHttp快速搞定接口分析

本文详细介绍了如何在PC端使用Fiddler Everywhere和OkHttp进行微信小程序接口抓取与分析。从环境配置、请求捕获到代码复现,提供了一套完整的解决方案,帮助开发者高效完成数据抓取任务,特别适合需要分析微信小程序数据交互的开发者。

weixin_30838873的博客 344

安装fcitx4.1.2时遇到INTLTOOL_MERGE-NOTFOUND

centos下sublime不能用ibus中文输入,安装fcitx4.1.2时遇到INTLTOOL_MERGE-NOTFOUND, 批量替换当前目录下所有文件中的INTLTOOL_MERGE-NOTFOUND为intltool-merge 即可: sed -i "s/INTLTOOL_MERGE-NOTFOUND/intltool-merge/g" `grep INTLTOOL_MERGE-NO

stonebreak57的专栏 973

从SSD到UFS:3分钟搞懂存储技术进化史(含最新协议对比)

本文梳理了从SSD到UFS的存储技术演进历程,重点解析了eMMC与UFS在架构上的核心差异。UFS凭借高速串行全双工接口,实现了性能与能效的飞跃。文章还对比了最新的UFS 4.0与PCIe 5.0 SSD协议,并探讨了3D NAND、SLC缓存等底层技术,揭示了移动与PC存储技术融合的未来趋势。

weixin_29294597的博客 289

Glib安装提示gettext问题的解决方法

问题在这,我也遇到了,百思不得其解 http://www.linuxsir.org/bbs/thread320899.html ---------------------------------------------------------------------------------------------------------------------------- 为了安装GTK,

ybdesire的专栏 1万+

Vector CANape的使用记录

开门见山,今天想和大家分享下CANape使用记录,分享原因是近日在分析一个客户现场软件问题时,需要用到CANape来实时的监测ECU中的变量,因为之前对CANape的认知比较浅薄,觉得标定工程师使用他就足够了,但是这次的经历让我觉得需要写点东西来记录自己学习并使用他的过程。 相信大家能够在网上找到很多关于如何使用CANape的文章,从新建Project到后面的数据的观测、保存以及回放等等。我个人也是这么学过来的,所以我不打算从那些方面着手去描述如何使用她,而是根据我的真实使用过程以及问题的抛出到如何解决来

2万+

基于Simulink开发一个完整的直驱式永磁同步发电机DDPMSG仿真模型

需求分析直驱式永磁同步发电机(Direct-Drive Permanent Magnet Synchronous Generator, DDPMSG)广泛应用于风力发电、海洋能发电等可再生能源领域。与传统的齿轮箱驱动系统相比,DDPMSG具有结构简单、效率高、可靠性好等优点,能够直接将机械能转换为电能,减少了中间传动环节,降低了维护成本。本项目将基于Simulink平台,开发一个完整的DDPMSG仿真模型,模拟其在风力发电场景中的应用。我们将详细讲解如何设计和实现该系统,并结合实际应用案例进行说明。

MHD0815的博客 469

GNU gettext

Frequently Asked Questions for GNU gettext Questions General     Where is the mailing list?     Where is the newest gettext source?     I want to be notified of new gettext releases. Proble

qk的专栏 2742

基于STM32设计的数字电子秤

当前项目是采用采用STM32+称重模块+OLED实现了简单的电子秤项目,称重模块上采用24位的ADC芯片,精度较高。实现了称重,校准、去皮等功能。

1万+

C++国际化改造实战:从硬编码到多语言支持的完整方案

在软件开发中,国际化与本地化是产品走向全球市场的关键能力。字符串编码与多语言资源管理是其中基础环节。C++标准库缺乏类似Java ResourceBundle的原生机制,传统gettext在跨平台场景存在适配成本。UTF-8编码统一与字符边界处理是C++国际化的首要前提。通过自研JSON映射表实现文本外部化、占位符格式化与运行时语言切换,能够高效支撑多语言项目落地。本文结合工程实践,梳理从编码规范、方案选型到测试维护的完整链路,为处理老项目国际化改造或新项目多语言设计提供参考。

weixin_33885676的博客 273

第4.4节:保护轴承与安全系统

飞轮储能系统的保护轴承是磁悬浮失效时的最后安全屏障,其设计需满足非干涉性、高可靠性和有限寿命承载原则。转子跌落过程包括自由下落、碰撞、进动和滑行减速等复杂非线性阶段,产生远超常规工况的冲击载荷。保护轴承需具备极限冲击容量、高温耐受性和抗卡死能力。系统采用多层级安全架构,结合故障诊断与健康管理,通过监测振动、电流等参数实现预测性维护。安全停机序列有序结合主动制动与被动摩擦制动,确保系统在极端工况下的安全。保护轴承类型多样,需根据系统规模与可靠性要求合理选择。

技术工作者 238

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

LIB-ZC:C/C++跨平台命令行与配置管理库的设计与实现

在C/C++系统编程中,命令行参数解析和配置文件管理是构建健壮应用的基础。其核心原理在于提供统一的接口,处理用户输入和外部配置的读取、验证与优先级覆盖。这类技术的价值在于提升开发效率,确保代码的可维护性和跨平台兼容性,是构建服务端工具、嵌入式系统及后台服务的关键基础设施。LIB-ZC库正是这一理念的工程实践,它专注于提供一套**零外部依赖**、API直观的解决方案,通过封装命令行解析(支持标志、带值选项、位置参数和子命令)与多格式配置管理(如INI、JSON),并实现**模块联动**,让开发者能快速构建出配

weixin_33670713的博客 359

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex&trade;-M4F 内核的信息,请参见《Cortex&trade;-M4F 技术参考手册》。

Qt6实战避坑指南:从安装配置到跨平台发布

Qt6不是Qt5的简单升级,而是面向现代C++(C++17/20)与模块化架构的范式重构。其核心原理在于按需加载的模块化设计、CMake原生构建体系及跨平台toolchain严格耦合,带来显著的可执行体积压缩、嵌入式渲染性能提升与跨平台一致性保障。技术价值体现在工业HMI实时渲染、高DPI桌面应用、ARM64嵌入式部署等关键场景;尤其在Qt6安装配置、Qt6模块化依赖管理、Qt6交叉编译环境搭建等环节,极易因版本错配、工具链不兼容或CMake配置遗漏引发静默失败。本文聚焦真实产线中高频踩坑点,覆盖Qt6安装

weixin_33966095的博客 421

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

CrossPoint Reader 开发指南:面向 380KB RAM 约束的 ESP32-C3 电子书固件工程实践

本篇技术指南基于开源电子书阅读器固件 CrossPoint Reader(Xteink X4,ESP32-C3)的官方开发规范([AGENTS.md](https://link.gitcode.com/i/55fad871d85700cfb45760d853205f99))展开,系统讲解其在 380KB 可用 RAM 硬约束下的内存资源协议、PlatformIO 构建体系、HAL 分层架构、ESP

gitblog_00098的博客 434

CrossPoint Reader 开发指南:面向 ESP32-C3 嵌入式固件的内存约束、架构规范与调试实践

CrossPoint Reader 是一款面向 Xteink X4(ESP32-C3)的**开源电子书阅读器固件**,其使命是在资源极度受限的硬件上提供轻量、高性能、专注于 EPUB 渲染的阅读体验。本文是仓库内 [CLAUDE.md](https://link.gitcode.com/i/68905a3d6622622be3bbe7a0a3de187b) 这份核心开发文档的系统化解读:它以"38

gitblog_00488的博客 732

《Linux From Scratch》第三部分:构建LFS系统 第六章:安装基本的系统软件- 6.50. Intltool-0.50.2...

Intltool 是一个用于从源文件中抽取可翻译字符串的国际化工具。 大概编译时间: 少于 0.1 SBU 需要磁盘空间: 1.3 MB ...

weixin_34396103的博客 220

LINUX国际化(i18n)

PO: Portable Object (可移植对象) MO: Machine Object (机器对象)  二进制文件 1)获取要国际化的字符串,生成PO文件  xgettext -k_ -o po文件 源文件 2)PO转MO  msgfmt -o mo文件 po文件 3)复制MO到标准路径  cp mo文件 /usr/share/

在线笔记 1277

linux intltool作用,在Linux中编译文件时出现:Your intltool is too old. You need intltool 0.35.0 or later...

安装以前版本的intltool:如果确定系统中有可以跳过:下载地址 (HTTP): http://ftp.gnome.org/pub/GNOME/sources/intltool/0.25/intltool-0.25.tar.bz2下载地址 (FTP): ftp://ftp.gnome.org/pub/GNOME/sources/intltool/0.25/intltoo...

weixin_42635064的博客 991

如何使用gettext, po, mo制作多语言应用程序 (转)

一、翻译档制作部分 1、制作po档(1)生成template文件xgettext -k_ -o ui_pref.pot ui.c pref.pot head.#, fuzzymsgid ""msgstr """Project-Id-Version: PACKAGE VERSION/n"

cigogo的专栏 3589

分布式版本控制工具学习--Git

    什么是分布式版本控制:         分布式版本控制 (DVCS) 是一种不需要中心服务器的管理文件版本的方法,但是它也可以使用中心服务器。更改可以被合并到 DVCS 的任何其他用户的系统中,因此可以实现非常灵活的工作流。    DVCS 和集中式版本控制系统的主要差异: 在 DVCS 和集中式版本控制系统之间有三个关键差异。 第一个差异是,DVCS 通过本地提交支持离线工作,这...

惊堂木 345

i18n和i10n:国际化&本地化--gettext

[正文] froward 软件编写和文档通常使用英文,这便于世界各地的程序员交流,但是并非所有用户都懂英文,所以程序能显示为用户的母语,能使软件用户群更大,且方便了普通用户。 过去我们讲“汉化”,在有了“Internationalization(国际化)”和“localization(本地化)”的概念和技术之后,“汉化”这个词要进入博物馆了  本文介绍G

senlin1202的博客 9537

I18N和L10N

  I18N就是Internationalization(该单词的首字母I与尾字母N中间隔着18个字符)。它是一个代码修改的过程,目的是实现代码完全独立于任何特定的文化信息。这类信息保存在外部文件里,在程序运行的时候被装入。有些人可能想,只要把程序中所有特定文化有关的字符串(hard-coded strings)都抽取出来放在外部的文件中,就已为国际化做好准备了。其实,除了这个,还有一些事情需要考

tommwang的专栏 7249
上一篇: 对lua #(取长度)操作符的理解
下一篇: lua5.3.5 gc源码分析笔记
Gitar520
博客等级 码龄15年 24粉丝 8原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值