mirror of
https://src.fedoraproject.org/rpms/nodejs18.git
synced 2024-11-24 09:42:43 +00:00
Add proper i18n support
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
This commit is contained in:
parent
83b7eb4ea0
commit
24df70972b
4 changed files with 179 additions and 30 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -108,3 +108,4 @@
|
|||
/node-v10.9.0-stripped.tar.gz
|
||||
/node-v10.10.0-stripped.tar.gz
|
||||
/node-v10.11.0-stripped.tar.gz
|
||||
/icu4c-64_2-src.tgz
|
||||
|
|
151
btest402.js
Normal file
151
btest402.js
Normal file
|
@ -0,0 +1,151 @@
|
|||
// Copyright (C) 2014 IBM Corporation and Others. All Rights Reserved.
|
||||
// This file is part of the Node.JS ICU enablement work
|
||||
// https://github.com/joyent/node/pull/7719
|
||||
// and is under the same license.
|
||||
//
|
||||
// This is a very, very, very basic test of es402
|
||||
//
|
||||
// URL: https://github.com/srl295/btest402
|
||||
// Author: Steven R. Loomis <srl@icu-project.org>
|
||||
//
|
||||
// for a complete test, see http://test262.ecmascript.org
|
||||
//
|
||||
// Usage: node btest402.js
|
||||
|
||||
try {
|
||||
console.log("You have console.log.");
|
||||
} catch(e) {
|
||||
// this works on d8
|
||||
console = { log: print };
|
||||
console.log("Now you have console.log.");
|
||||
}
|
||||
|
||||
function runbtest() {
|
||||
var summary = {};
|
||||
|
||||
try {
|
||||
var i = Intl;
|
||||
summary.haveIntl = true;
|
||||
console.log("+ Congrats, you have the Intl object.");
|
||||
} catch(e) {
|
||||
console.log("You don't have the Intl object: " + e);
|
||||
}
|
||||
|
||||
if(summary.haveIntl) {
|
||||
var locs = [ "en", "mt", "ja","tlh"];
|
||||
var d = new Date(196400000);
|
||||
for ( var n=0; n<locs.length; n++ ) {
|
||||
var loc = locs[n];
|
||||
var lsummary = summary[loc] = {};
|
||||
|
||||
console.log(loc+":");
|
||||
var sl=null;
|
||||
try {
|
||||
sl = Intl.DateTimeFormat.supportedLocalesOf([loc]);
|
||||
if( sl.length > 0 ) {
|
||||
lsummary.haveSlo = true;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("SLO err: " + e);
|
||||
}
|
||||
var dstr = "ERR";
|
||||
try {
|
||||
lsummary.dstr = d.toLocaleString(loc,{month: "long",day:"numeric",weekday:"long",year:"numeric"});
|
||||
console.log(" date: (supported:"+sl+") " + lsummary.dstr);
|
||||
} catch (e) {
|
||||
console.log(" Date Format err: " + e);
|
||||
}
|
||||
try {
|
||||
new Intl.v8BreakIterator();
|
||||
console.log(" Intl.v8BreakIterator:" +
|
||||
Intl.v8BreakIterator.supportedLocalesOf(loc) + " Supported, first()==" +
|
||||
new Intl.v8BreakIterator(loc).first() );
|
||||
lsummary.brkOk = true;
|
||||
} catch ( e) {
|
||||
console.log(" Intl.v8BreakIterator error (NOT part of EcmaScript402): " + e);
|
||||
}
|
||||
console.log();
|
||||
}
|
||||
}
|
||||
|
||||
// print summary
|
||||
console.log();
|
||||
console.log("--------- Analysis ---------");
|
||||
stxt = "";
|
||||
if( summary.haveIntl ) {
|
||||
console.log("* You have the 'Intl' object. Congratulations! You have the possibility of being EcmaScript 402 compliant.");
|
||||
stxt += "Have Intl, ";
|
||||
|
||||
if ( !summary.en.haveSlo ) {
|
||||
stxt += "Date:no EN, ";
|
||||
console.log("* English isn't a supported language by the date formatter. Perhaps the data isn't installed properly?");
|
||||
}
|
||||
if ( !summary.tlh.haveSlo ) {
|
||||
stxt += "Date:no 'tlh', ";
|
||||
console.log("* Klingon isn't a supported language by the date formatter. It is without honor!");
|
||||
}
|
||||
// now, what is it actually saying
|
||||
if( summary.en.dstr.indexOf("1970") == -1) {
|
||||
stxt += "Date:bad 'en', ";
|
||||
console.log("* the English date format text looks bad to me. Doesn't even have the year.");
|
||||
} else {
|
||||
if( summary.en.dstr.indexOf("Jan") == -1) {
|
||||
stxt += "Date:bad 'en', ";
|
||||
console.log("* The English date format text looks bad to me. Doesn't have the right month.");
|
||||
}
|
||||
}
|
||||
|
||||
if( summary.mt.dstr == summary.en.dstr ) {
|
||||
stxt += "Date:'mt'=='en', ";
|
||||
console.log("* The English and Maltese look the same to me. Probably a 'small' build.");
|
||||
} else if( summary.mt.dstr.indexOf("1970") == -1) {
|
||||
stxt += "Date:bad 'mt', ";
|
||||
console.log("* the Maltese date format text looks bad to me. Doesn't even have the year. (This data is missing from the Chromium ICU build)");
|
||||
} else {
|
||||
if( summary.mt.dstr.indexOf("Jann") == -1) {
|
||||
stxt += "Date:bad 'mt', ";
|
||||
console.log("* The Maltese date format text looks bad to me. Doesn't have the right month. (This data is missing from the Chromium ICU build)");
|
||||
}
|
||||
}
|
||||
|
||||
if ( !summary.ja.haveSlo ) {
|
||||
stxt += "Date:no 'ja', ";
|
||||
console.log("* Japanese isn't a supported language by the date formatter. Could be a 'small' build.");
|
||||
} else {
|
||||
if( summary.ja.dstr.indexOf("1970") == -1) {
|
||||
stxt += "Date:bad 'ja', ";
|
||||
console.log("* the Japanese date format text looks bad to me. Doesn't even have the year.");
|
||||
} else {
|
||||
if( summary.ja.dstr.indexOf("日") == -1) {
|
||||
stxt += "Date:bad 'ja', ";
|
||||
console.log("* The Japanese date format text looks bad to me.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( summary.en.brkOk ) {
|
||||
stxt += "FYI: v8Brk:have 'en', ";
|
||||
console.log("* You have Intl.v8BreakIterator support. (Note: not part of ES402.)");
|
||||
}
|
||||
} else {
|
||||
console.log("* You don't have the 'Intl' object. You aren't EcmaScript 402 compliant.");
|
||||
stxt += " NO Intl. ";
|
||||
}
|
||||
|
||||
// 1-liner.
|
||||
console.log();
|
||||
console.log("----------------");
|
||||
console.log( "SUMMARY:" + stxt );
|
||||
}
|
||||
|
||||
var dorun = true;
|
||||
|
||||
try {
|
||||
if(btest402_noautorun) {
|
||||
dorun = false;
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
if(dorun) {
|
||||
console.log("Running btest..");
|
||||
runbtest();
|
||||
}
|
56
nodejs.spec
56
nodejs.spec
|
@ -8,7 +8,7 @@
|
|||
# This is used by both the nodejs package and the npm subpackage thar
|
||||
# has a separate version - the name is special so that rpmdev-bumpspec
|
||||
# will bump this rather than adding .1 to the end.
|
||||
%global baserelease 5
|
||||
%global baserelease 6
|
||||
|
||||
%{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}}
|
||||
|
||||
|
@ -76,15 +76,15 @@
|
|||
%global icu_minor 2
|
||||
%global icu_version %{icu_major}.%{icu_minor}
|
||||
|
||||
%global bundled_icu 1
|
||||
%global sys_icu_version %(/usr/bin/icu-config --version)
|
||||
|
||||
%if 0%{?bundled_icu}
|
||||
%global icu_flag small-icu
|
||||
%else
|
||||
%if sys_icu_version >= icu_version
|
||||
%global bundled_icu 0
|
||||
%global icu_flag system-icu
|
||||
%else
|
||||
%global bundled_icu 1
|
||||
%global icu_flag full-icu
|
||||
%endif
|
||||
%{!?little_endian: %global little_endian %(%{__python3} -c "import sys;print (0 if sys.byteorder=='big' else 1)")}
|
||||
# " this line just fixes syntax highlighting for vim that is confused by the above and continues literal
|
||||
|
||||
|
||||
# OpenSSL minimum version
|
||||
|
@ -128,6 +128,8 @@ ExclusiveArch: %{nodejs_arches}
|
|||
# the tarball, using the script in Source100
|
||||
Source0: node-v%{nodejs_version}-stripped.tar.gz
|
||||
Source1: npmrc
|
||||
Source2: btest402.js
|
||||
Source3: https://github.com/unicode-org/icu/releases/download/release-%{icu_major}-%{icu_minor}/icu4c-%{icu_major}_%{icu_minor}-src.tgz
|
||||
Source100: %{name}-tarball.sh
|
||||
|
||||
# The native module Requires generator remains in the nodejs SRPM, so it knows
|
||||
|
@ -171,10 +173,7 @@ Provides: bundled(llhttp) = %{llhttp_version}
|
|||
|
||||
%endif
|
||||
|
||||
|
||||
%if 0%{?fedora} >= 29
|
||||
BuildRequires: libicu-devel >= 62.1
|
||||
%endif
|
||||
BuildRequires: libicu-devel
|
||||
|
||||
BuildRequires: openssl-devel >= %{openssl_minimum}
|
||||
Requires: openssl >= %{openssl_minimum}
|
||||
|
@ -341,6 +340,13 @@ The API documentation for the Node.js JavaScript runtime.
|
|||
# remove bundled dependencies that we aren't building
|
||||
rm -rf deps/zlib
|
||||
|
||||
%if bundled_icu
|
||||
pushd deps/
|
||||
rm -rf icu-small
|
||||
tar xfz %SOURCE3
|
||||
popd
|
||||
%endif
|
||||
|
||||
# Replace any instances of unversioned python' with python2
|
||||
pathfix.py -i %{__python2} -pn $(find -type f ! -name "*.js")
|
||||
find . -type f -exec sed -i "s~/usr\/bin\/env python~/usr/bin/python2~" {} \;
|
||||
|
@ -359,6 +365,9 @@ sed -i "s~which('python')~which('python2')~" configure
|
|||
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
|
||||
%endif
|
||||
|
||||
export CC='gcc'
|
||||
export CXX='g++'
|
||||
|
||||
# build with debugging symbols and add defines from libuv (#892601)
|
||||
# Node's v8 breaks with GCC 6 because of incorrect usage of methods on
|
||||
# NULL objects. We need to pass -fno-delete-null-pointer-checks
|
||||
|
@ -428,17 +437,6 @@ for soname in libv8 libv8_libbase libv8_libplatform; do
|
|||
ln -s %{_libdir}/libnode.so.%{nodejs_soversion} %{buildroot}%{_libdir}/${soname}.so.%{v8_major}
|
||||
done
|
||||
|
||||
# When using small-icu, carry the icudt64{l,b}.dat
|
||||
%if 0%{?bundled_icu}
|
||||
%if 0%{?little_endian}
|
||||
cp -a out/Release/obj/gen/icutmp/icudt64l.dat \
|
||||
%{buildroot}%{_libdir}/icudt64l.dat
|
||||
%else
|
||||
cp -a out/Release/obj/gen/icutmp/icudt64b.dat \
|
||||
%{buildroot}%{_libdir}/icudt64b.dat
|
||||
%endif
|
||||
%endif
|
||||
|
||||
# own the sitelib directory
|
||||
mkdir -p %{buildroot}%{_prefix}/lib/node_modules
|
||||
|
||||
|
@ -521,6 +519,9 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require(
|
|||
# Ensure we have npm and that the version matches
|
||||
NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node -e "require(\"assert\").equal(require(\"npm\").version, '%{npm_version}')"
|
||||
|
||||
# Make sure i18n support is working
|
||||
NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules:%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}/%{_bindir}/node %{SOURCE2}
|
||||
|
||||
|
||||
%pretrans -n npm -p <lua>
|
||||
-- Remove all of the symlinks from the bundled npm node_modules directory
|
||||
|
@ -638,14 +639,6 @@ end
|
|||
%{_libdir}/libv8_libbase.so.%{v8_major}
|
||||
%{_libdir}/libv8_libplatform.so.%{v8_major}
|
||||
|
||||
%if 0%{?bundled_icu}
|
||||
%if 0%{?little_endian}
|
||||
%{_libdir}/icudt64l.dat
|
||||
%else
|
||||
%{_libdir}/icudt64b.dat
|
||||
%endif
|
||||
%endif
|
||||
|
||||
|
||||
%files -n v8-devel
|
||||
%{_includedir}/libplatform
|
||||
|
@ -678,6 +671,9 @@ end
|
|||
%{_pkgdocdir}/npm/doc
|
||||
|
||||
%changelog
|
||||
* Tue Oct 29 2019 Stephen Gallagher <sgallagh@redhat.com> - 1:12.13.0-6
|
||||
- Add proper i18n support
|
||||
|
||||
* Tue Oct 29 2019 Stephen Gallagher <sgallagh@redhat.com> - 1:12.13.0-5
|
||||
- Fix issue with NPM docs being replaced with a symlink
|
||||
|
||||
|
|
1
sources
1
sources
|
@ -1 +1,2 @@
|
|||
SHA512 (icu4c-64_2-src.tgz) = 5ecb4c230ba45918747a1cf9aef86f555aa07d5b29b1d07ab674e8013f46dfb907a0e9d6945db41155f9dc3012fd94e1152ffc19f61a68b6dfcbabdcb8ae9d78
|
||||
SHA512 (node-v12.13.0-stripped.tar.gz) = be475255aaddcd6f5b26fbbc8a4ec7c29538fd9fe7115f93710606a7d876d3e44568f623ce1ca9e90b2db22499d61d6b61e680524217f67f4976493afbc2427f
|
||||
|
|
Loading…
Reference in a new issue